All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: OCTEON: add put_device() after of_find_device_by_node()
@ 2021-11-16  8:10 cgel.zte
  2021-12-16 15:06 ` Thomas Bogendoerfer
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-16  8:10 UTC (permalink / raw)
  To: tsbogend; +Cc: ye.guojin, yangyingliang, linux-mips, linux-kernel, Zeal Robot

From: Ye Guojin <ye.guojin@zte.com.cn>

This was found by coccicheck:
./arch/mips/cavium-octeon/octeon-platform.c, 332, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 324, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-platform.c, 395, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 387, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-usb.c, 512, 3-9, ERROR missing
put_device; call of_find_device_by_node on line 515, but without a
corresponding object release within this function.
./arch/mips/cavium-octeon/octeon-usb.c, 543, 1-7, ERROR missing
put_device; call of_find_device_by_node on line 515, 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>
---
 arch/mips/cavium-octeon/octeon-platform.c | 2 ++
 arch/mips/cavium-octeon/octeon-usb.c      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index d56e9b9d2e43..a994022e32c9 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void)
 
 	pd->dev.platform_data = &octeon_ehci_pdata;
 	octeon_ehci_hw_start(&pd->dev);
+	put_device(&pd->dev);
 
 	return ret;
 }
@@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void)
 
 	pd->dev.platform_data = &octeon_ohci_pdata;
 	octeon_ohci_hw_start(&pd->dev);
+	put_device(&pd->dev);
 
 	return ret;
 }
diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c
index 6e4d3619137a..4df919d26b08 100644
--- a/arch/mips/cavium-octeon/octeon-usb.c
+++ b/arch/mips/cavium-octeon/octeon-usb.c
@@ -537,6 +537,7 @@ static int __init dwc3_octeon_device_init(void)
 			devm_iounmap(&pdev->dev, base);
 			devm_release_mem_region(&pdev->dev, res->start,
 						resource_size(res));
+			put_device(&pdev->dev);
 		}
 	} while (node != NULL);
 
-- 
2.25.1


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

* Re: [PATCH] MIPS: OCTEON: add put_device() after of_find_device_by_node()
  2021-11-16  8:10 [PATCH] MIPS: OCTEON: add put_device() after of_find_device_by_node() cgel.zte
@ 2021-12-16 15:06 ` Thomas Bogendoerfer
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Bogendoerfer @ 2021-12-16 15:06 UTC (permalink / raw)
  To: cgel.zte; +Cc: ye.guojin, yangyingliang, linux-mips, linux-kernel, Zeal Robot

On Tue, Nov 16, 2021 at 08:10:51AM +0000, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
> 
> This was found by coccicheck:
> ./arch/mips/cavium-octeon/octeon-platform.c, 332, 1-7, ERROR missing
> put_device; call of_find_device_by_node on line 324, but without a
> corresponding object release within this function.
> ./arch/mips/cavium-octeon/octeon-platform.c, 395, 1-7, ERROR missing
> put_device; call of_find_device_by_node on line 387, but without a
> corresponding object release within this function.
> ./arch/mips/cavium-octeon/octeon-usb.c, 512, 3-9, ERROR missing
> put_device; call of_find_device_by_node on line 515, but without a
> corresponding object release within this function.
> ./arch/mips/cavium-octeon/octeon-usb.c, 543, 1-7, ERROR missing
> put_device; call of_find_device_by_node on line 515, 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>
> ---
>  arch/mips/cavium-octeon/octeon-platform.c | 2 ++
>  arch/mips/cavium-octeon/octeon-usb.c      | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
> index d56e9b9d2e43..a994022e32c9 100644
> --- a/arch/mips/cavium-octeon/octeon-platform.c
> +++ b/arch/mips/cavium-octeon/octeon-platform.c
> @@ -328,6 +328,7 @@ static int __init octeon_ehci_device_init(void)
>  
>  	pd->dev.platform_data = &octeon_ehci_pdata;
>  	octeon_ehci_hw_start(&pd->dev);
> +	put_device(&pd->dev);
>  
>  	return ret;
>  }
> @@ -391,6 +392,7 @@ static int __init octeon_ohci_device_init(void)
>  
>  	pd->dev.platform_data = &octeon_ohci_pdata;
>  	octeon_ohci_hw_start(&pd->dev);
> +	put_device(&pd->dev);
>  
>  	return ret;
>  }
> diff --git a/arch/mips/cavium-octeon/octeon-usb.c b/arch/mips/cavium-octeon/octeon-usb.c
> index 6e4d3619137a..4df919d26b08 100644
> --- a/arch/mips/cavium-octeon/octeon-usb.c
> +++ b/arch/mips/cavium-octeon/octeon-usb.c
> @@ -537,6 +537,7 @@ static int __init dwc3_octeon_device_init(void)
>  			devm_iounmap(&pdev->dev, base);
>  			devm_release_mem_region(&pdev->dev, res->start,
>  						resource_size(res));
> +			put_device(&pdev->dev);
>  		}
>  	} while (node != NULL);
>  
> -- 
> 2.25.1

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

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

end of thread, other threads:[~2021-12-16 15:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16  8:10 [PATCH] MIPS: OCTEON: add put_device() after of_find_device_by_node() cgel.zte
2021-12-16 15:06 ` Thomas Bogendoerfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.