diff mbox series

scsi: sun_esp: : Fix object reference leaks in esp_sbus_probe

Message ID 1553644557-35817-1-git-send-email-huang.zijiang@zte.com.cn (mailing list archive)
State Deferred
Headers show
Series scsi: sun_esp: : Fix object reference leaks in esp_sbus_probe | expand

Commit Message

Huang Zijiang March 26, 2019, 11:55 p.m. UTC
The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference whatever of_find_device_by_node
reutrns.

Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
---
 drivers/scsi/sun_esp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mukesh Ojha March 27, 2019, 12:47 p.m. UTC | #1
Sorry for the spam whosoever has got the last mail, as the last did not 
get to
the mailing list, and it bounced, so sending it again.

On 3/27/2019 5:25 AM, Huang Zijiang wrote:
> The of_find_device_by_node() takes a reference to the underlying device
> structure, we should release that reference whatever of_find_device_by_node
> reutrns.
s/reutrns/returns
>
> Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>



Take mine review tag once you make above change.

Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

-Mukesh



> ---
>   drivers/scsi/sun_esp.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
> index a11efbc..a74605a 100644
> --- a/drivers/scsi/sun_esp.c
> +++ b/drivers/scsi/sun_esp.c
> @@ -543,9 +543,8 @@ static int esp_sbus_probe(struct platform_device *op)
>   		return -ENODEV;
>   
>   	ret = esp_sbus_probe_one(op, dma_of, hme);
> -	if (ret)
> -		put_device(&dma_of->dev);
>   
> +	put_device(&dma_of->dev);
>   	return ret;
>   }
>
diff mbox series

Patch

diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index a11efbc..a74605a 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -543,9 +543,8 @@  static int esp_sbus_probe(struct platform_device *op)
 		return -ENODEV;
 
 	ret = esp_sbus_probe_one(op, dma_of, hme);
-	if (ret)
-		put_device(&dma_of->dev);
 
+	put_device(&dma_of->dev);
 	return ret;
 }