Linux USB
 help / color / mirror / Atom feed
* [PATCH -next] usb: isp116x-hcd: Remove unnecessary check of res
@ 2023-08-16  7:34 Ruan Jinjie
  2023-08-16 14:46 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 2+ messages in thread
From: Ruan Jinjie @ 2023-08-16  7:34 UTC (permalink / raw)
  To: linux-usb, Olav Kongas, Greg Kroah-Hartman; +Cc: ruanjinjie

The resource is checked in probe function, so there is
no need do this check in remove function.

Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
---
 drivers/usb/host/isp116x-hcd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index a82d8926e922..c95a9b004412 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1540,12 +1540,10 @@ static void isp116x_remove(struct platform_device *pdev)
 
 	iounmap(isp116x->data_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (res)
-		release_mem_region(res->start, 2);
+	release_mem_region(res->start, 2);
 	iounmap(isp116x->addr_reg);
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res)
-		release_mem_region(res->start, 2);
+	release_mem_region(res->start, 2);
 
 	usb_put_hcd(hcd);
 }
-- 
2.34.1


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

* Re: [PATCH -next] usb: isp116x-hcd: Remove unnecessary check of res
  2023-08-16  7:34 [PATCH -next] usb: isp116x-hcd: Remove unnecessary check of res Ruan Jinjie
@ 2023-08-16 14:46 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 2+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-16 14:46 UTC (permalink / raw)
  To: Ruan Jinjie; +Cc: linux-usb, Olav Kongas

On Wed, Aug 16, 2023 at 03:34:32PM +0800, Ruan Jinjie wrote:
> The resource is checked in probe function, so there is
> no need do this check in remove function.
> 
> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> ---
>  drivers/usb/host/isp116x-hcd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
> index a82d8926e922..c95a9b004412 100644
> --- a/drivers/usb/host/isp116x-hcd.c
> +++ b/drivers/usb/host/isp116x-hcd.c
> @@ -1540,12 +1540,10 @@ static void isp116x_remove(struct platform_device *pdev)
>  
>  	iounmap(isp116x->data_reg);
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -	if (res)
> -		release_mem_region(res->start, 2);
> +	release_mem_region(res->start, 2);
>  	iounmap(isp116x->addr_reg);
>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (res)
> -		release_mem_region(res->start, 2);
> +	release_mem_region(res->start, 2);

Perhaps, but now you will get in a fight with the "auto fix tools" that
will notice that those functions can fail, so the return value must be
checked.

So you are in an argument you can't win, let's just leave these as-is to
keep the static-tool-checkers happy.  It's on a remove path, it doesn't
really matter.

thanks,

greg k-h

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

end of thread, other threads:[~2023-08-16 14:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-16  7:34 [PATCH -next] usb: isp116x-hcd: Remove unnecessary check of res Ruan Jinjie
2023-08-16 14:46 ` Greg Kroah-Hartman

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