mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode()
@ 2024-10-19 20:27 Javier Carrasco
  2024-10-19 20:32 ` Javier Carrasco
  2024-10-21  2:29 ` Zhihao Cheng
  0 siblings, 2 replies; 3+ messages in thread
From: Javier Carrasco @ 2024-10-19 20:27 UTC (permalink / raw)
  To: Richard Weinberger, Zhihao Cheng, Miquel Raynal,
	Vignesh Raghavendra, Daniel Golle
  Cc: linux-mtd, linux-kernel, Javier Carrasco

The 'fw_vols' fwnode_handle initialized via
device_get_named_child_node() requires explicit calls to
fwnode_handle_put() when the variable is no longer required.

Add the missing calls to fwnode_handle_put() before the function
returns.

Fixes: 51932f9fc487 ("mtd: ubi: populate ubi volume fwnode")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
---
 drivers/mtd/ubi/vmt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 5a3558bbb903..e5cf3bdca3b0 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -143,8 +143,10 @@ static struct fwnode_handle *find_volume_fwnode(struct ubi_volume *vol)
 		    vol->vol_id != volid)
 			continue;
 
+		fwnode_handle_put(fw_vols);
 		return fw_vol;
 	}
+	fwnode_handle_put(fw_vols);
 
 	return NULL;
 }

---
base-commit: f2493655d2d3d5c6958ed996b043c821c23ae8d3
change-id: 20241019-mtd-uvi-fwnode_handle_put-7b220d2778b5

Best regards,
-- 
Javier Carrasco <javier.carrasco.cruz@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode()
  2024-10-19 20:27 [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode() Javier Carrasco
@ 2024-10-19 20:32 ` Javier Carrasco
  2024-10-21  2:29 ` Zhihao Cheng
  1 sibling, 0 replies; 3+ messages in thread
From: Javier Carrasco @ 2024-10-19 20:32 UTC (permalink / raw)
  To: Richard Weinberger, Zhihao Cheng, Miquel Raynal,
	Vignesh Raghavendra, Daniel Golle
  Cc: linux-mtd, linux-kernel

On 19/10/2024 22:27, Javier Carrasco wrote:
> The 'fw_vols' fwnode_handle initialized via
> device_get_named_child_node() requires explicit calls to
> fwnode_handle_put() when the variable is no longer required.
> 
> Add the missing calls to fwnode_handle_put() before the function
> returns.
> 
> Fixes: 51932f9fc487 ("mtd: ubi: populate ubi volume fwnode")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
>  drivers/mtd/ubi/vmt.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
> index 5a3558bbb903..e5cf3bdca3b0 100644
> --- a/drivers/mtd/ubi/vmt.c
> +++ b/drivers/mtd/ubi/vmt.c
> @@ -143,8 +143,10 @@ static struct fwnode_handle *find_volume_fwnode(struct ubi_volume *vol)
>  		    vol->vol_id != volid)
>  			continue;
>  
> +		fwnode_handle_put(fw_vols);
>  		return fw_vol;
>  	}
> +	fwnode_handle_put(fw_vols);
>  
>  	return NULL;
>  }
> 
> ---
> base-commit: f2493655d2d3d5c6958ed996b043c821c23ae8d3
> change-id: 20241019-mtd-uvi-fwnode_handle_put-7b220d2778b5
> 
> Best regards,

I just saw that the bug was introduced in late Dec. 2023, so maybe a

Cc: stable@vger.kernel.org

will be necessary in this case, right?

Best regards,
Javier Carrasco

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode()
  2024-10-19 20:27 [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode() Javier Carrasco
  2024-10-19 20:32 ` Javier Carrasco
@ 2024-10-21  2:29 ` Zhihao Cheng
  1 sibling, 0 replies; 3+ messages in thread
From: Zhihao Cheng @ 2024-10-21  2:29 UTC (permalink / raw)
  To: Javier Carrasco, Richard Weinberger, Miquel Raynal,
	Vignesh Raghavendra, Daniel Golle
  Cc: linux-mtd, linux-kernel

在 2024/10/20 4:27, Javier Carrasco 写道:
> The 'fw_vols' fwnode_handle initialized via
> device_get_named_child_node() requires explicit calls to
> fwnode_handle_put() when the variable is no longer required.
> 
> Add the missing calls to fwnode_handle_put() before the function
> returns.
> 
> Fixes: 51932f9fc487 ("mtd: ubi: populate ubi volume fwnode")
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
> ---
>   drivers/mtd/ubi/vmt.c | 2 ++
>   1 file changed, 2 insertions(+)

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
> 
> diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
> index 5a3558bbb903..e5cf3bdca3b0 100644
> --- a/drivers/mtd/ubi/vmt.c
> +++ b/drivers/mtd/ubi/vmt.c
> @@ -143,8 +143,10 @@ static struct fwnode_handle *find_volume_fwnode(struct ubi_volume *vol)
>   		    vol->vol_id != volid)
>   			continue;
>   
> +		fwnode_handle_put(fw_vols);
>   		return fw_vol;
>   	}
> +	fwnode_handle_put(fw_vols);
>   
>   	return NULL;
>   }
> 
> ---
> base-commit: f2493655d2d3d5c6958ed996b043c821c23ae8d3
> change-id: 20241019-mtd-uvi-fwnode_handle_put-7b220d2778b5
> 
> Best regards,
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-21  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-19 20:27 [PATCH] mtd: ubi: fix unreleased fwnode_handle in find_volume_fwnode() Javier Carrasco
2024-10-19 20:32 ` Javier Carrasco
2024-10-21  2:29 ` Zhihao Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®