diff mbox series

scsi: ufs: ufs-mediatek: add put_device() after of_find_device_by_node()

Message ID 20211110105133.150171-1-ye.guojin@zte.com.cn (mailing list archive)
State Accepted
Headers show
Series scsi: ufs: ufs-mediatek: add put_device() after of_find_device_by_node() | expand

Commit Message

CGEL Nov. 10, 2021, 10:51 a.m. UTC
From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./drivers/scsi/ufs/ufs-mediatek.c, 211, 1-7, ERROR missing put_device;
call of_find_device_by_node on line 1185, but without a corresponding
object release within this function.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
 drivers/scsi/ufs/ufs-mediatek.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Wang (王信友) Nov. 11, 2021, 5:41 a.m. UTC | #1
On 11/10/21 6:51 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
>
> This was found by coccicheck:
> ./drivers/scsi/ufs/ufs-mediatek.c, 211, 1-7, ERROR missing put_device;
> call of_find_device_by_node on line 1185, but without a corresponding
> object release within this function.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
> ---
>   drivers/scsi/ufs/ufs-mediatek.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> index fc5b214347b3..5393b5c9dd9c 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -1189,6 +1189,7 @@ static int ufs_mtk_probe(struct platform_device *pdev)
>   	}
>   	link = device_link_add(dev, &reset_pdev->dev,
>   		DL_FLAG_AUTOPROBE_CONSUMER);
> +	put_device(&reset_pdev->dev);

Thanks for fix this missing.
Reviewed-by: Peter Wang <peter.wang@mediatek.com>

>   	if (!link) {
>   		dev_notice(dev, "add reset device_link fail\n");
>   		goto skip_reset;
Peter Wang (王信友) Nov. 11, 2021, 5:52 a.m. UTC | #2
On 11/10/21 6:51 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
>
> This was found by coccicheck:
> ./drivers/scsi/ufs/ufs-mediatek.c, 211, 1-7, ERROR missing put_device;
> call of_find_device_by_node on line 1185, but without a corresponding
> object release within this function.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
> ---
>   drivers/scsi/ufs/ufs-mediatek.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
> index fc5b214347b3..5393b5c9dd9c 100644
> --- a/drivers/scsi/ufs/ufs-mediatek.c
> +++ b/drivers/scsi/ufs/ufs-mediatek.c
> @@ -1189,6 +1189,7 @@ static int ufs_mtk_probe(struct platform_device *pdev)
>   	}
>   	link = device_link_add(dev, &reset_pdev->dev,
>   		DL_FLAG_AUTOPROBE_CONSUMER);
> +	put_device(&reset_pdev->dev);


Thanks for fix this missing.
Reviewed-by: Peter Wang <peter.wang@mediatek.com>


>   	if (!link) {
>   		dev_notice(dev, "add reset device_link fail\n");
>   		goto skip_reset;
Martin K. Petersen Nov. 19, 2021, 4:16 a.m. UTC | #3
On Wed, 10 Nov 2021 10:51:33 +0000, cgel.zte@gmail.com wrote:

> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./drivers/scsi/ufs/ufs-mediatek.c, 211, 1-7, ERROR missing put_device;
> call of_find_device_by_node on line 1185, but without a corresponding
> object release within this function.
> 
> [...]

Applied to 5.16/scsi-fixes, thanks!

[1/1] scsi: ufs: ufs-mediatek: add put_device() after of_find_device_by_node()
      https://git.kernel.org/mkp/scsi/c/cc03facb1c42
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c
index fc5b214347b3..5393b5c9dd9c 100644
--- a/drivers/scsi/ufs/ufs-mediatek.c
+++ b/drivers/scsi/ufs/ufs-mediatek.c
@@ -1189,6 +1189,7 @@  static int ufs_mtk_probe(struct platform_device *pdev)
 	}
 	link = device_link_add(dev, &reset_pdev->dev,
 		DL_FLAG_AUTOPROBE_CONSUMER);
+	put_device(&reset_pdev->dev);
 	if (!link) {
 		dev_notice(dev, "add reset device_link fail\n");
 		goto skip_reset;