Linux-USB Archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags
@ 2024-03-07 10:51 Colin Ian King
  2024-03-07 16:51 ` Uwe Kleine-König
  0 siblings, 1 reply; 4+ messages in thread
From: Colin Ian King @ 2024-03-07 10:51 UTC (permalink / raw
  To: Greg Kroah-Hartman, u.kleine-koenig, linux-usb
  Cc: kernel-janitors, linux-kernel

The variable irqflags is being initialized and being bit-or'd with
values but it is never read afterwards. The variable is redundant
and can be removed.

Cleans up clang scan build warning:
drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags'
set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/usb/gadget/udc/net2272.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index 12e76bb62c20..afd2a836be6d 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -2607,7 +2607,6 @@ net2272_plat_probe(struct platform_device *pdev)
 {
 	struct net2272 *dev;
 	int ret;
-	unsigned int irqflags;
 	resource_size_t base, len;
 	struct resource *iomem, *iomem_bus, *irq_res;
 
@@ -2623,16 +2622,6 @@ net2272_plat_probe(struct platform_device *pdev)
 	if (IS_ERR(dev))
 		return PTR_ERR(dev);
 
-	irqflags = 0;
-	if (irq_res->flags & IORESOURCE_IRQ_HIGHEDGE)
-		irqflags |= IRQF_TRIGGER_RISING;
-	if (irq_res->flags & IORESOURCE_IRQ_LOWEDGE)
-		irqflags |= IRQF_TRIGGER_FALLING;
-	if (irq_res->flags & IORESOURCE_IRQ_HIGHLEVEL)
-		irqflags |= IRQF_TRIGGER_HIGH;
-	if (irq_res->flags & IORESOURCE_IRQ_LOWLEVEL)
-		irqflags |= IRQF_TRIGGER_LOW;
-
 	base = iomem->start;
 	len = resource_size(iomem);
 	if (iomem_bus)
-- 
2.39.2


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

* Re: [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags
  2024-03-07 10:51 [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags Colin Ian King
@ 2024-03-07 16:51 ` Uwe Kleine-König
  2024-03-07 17:29   ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Kleine-König @ 2024-03-07 16:51 UTC (permalink / raw
  To: Colin Ian King
  Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

On Thu, Mar 07, 2024 at 10:51:35AM +0000, Colin Ian King wrote:
> The variable irqflags is being initialized and being bit-or'd with
> values but it is never read afterwards. The variable is redundant
> and can be removed.
> 
> Cleans up clang scan build warning:
> drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags'
> set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

this "problem" exists since the driver was introduced in commit
ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device
controller"). Might be worth a Fixes: line.

I wonder if the better fix would be:

diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
index 12e76bb62c20..19bbc38f3d35 100644
--- a/drivers/usb/gadget/udc/net2272.c
+++ b/drivers/usb/gadget/udc/net2272.c
@@ -2650,7 +2650,7 @@ net2272_plat_probe(struct platform_device *pdev)
 		goto err_req;
 	}
 
-	ret = net2272_probe_fin(dev, IRQF_TRIGGER_LOW);
+	ret = net2272_probe_fin(dev, irqflags);
 	if (ret)
 		goto err_io;
 

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags
  2024-03-07 16:51 ` Uwe Kleine-König
@ 2024-03-07 17:29   ` Alan Stern
  2024-03-07 17:46     ` Colin King (gmail)
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Stern @ 2024-03-07 17:29 UTC (permalink / raw
  To: Uwe Kleine-König
  Cc: Colin Ian King, Greg Kroah-Hartman, linux-usb, kernel-janitors,
	linux-kernel

On Thu, Mar 07, 2024 at 05:51:59PM +0100, Uwe Kleine-König wrote:
> On Thu, Mar 07, 2024 at 10:51:35AM +0000, Colin Ian King wrote:
> > The variable irqflags is being initialized and being bit-or'd with
> > values but it is never read afterwards. The variable is redundant
> > and can be removed.
> > 
> > Cleans up clang scan build warning:
> > drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags'
> > set but not used [-Wunused-but-set-variable]
> > 
> > Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> 
> this "problem" exists since the driver was introduced in commit
> ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device
> controller"). Might be worth a Fixes: line.
> 
> I wonder if the better fix would be:
> 
> diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
> index 12e76bb62c20..19bbc38f3d35 100644
> --- a/drivers/usb/gadget/udc/net2272.c
> +++ b/drivers/usb/gadget/udc/net2272.c
> @@ -2650,7 +2650,7 @@ net2272_plat_probe(struct platform_device *pdev)
>  		goto err_req;
>  	}
>  
> -	ret = net2272_probe_fin(dev, IRQF_TRIGGER_LOW);
> +	ret = net2272_probe_fin(dev, irqflags);
>  	if (ret)
>  		goto err_io;

I agree, that makes much more sense.

Alan Stern

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

* Re: [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags
  2024-03-07 17:29   ` Alan Stern
@ 2024-03-07 17:46     ` Colin King (gmail)
  0 siblings, 0 replies; 4+ messages in thread
From: Colin King (gmail) @ 2024-03-07 17:46 UTC (permalink / raw
  To: Alan Stern, Uwe Kleine-König
  Cc: Greg Kroah-Hartman, linux-usb, kernel-janitors, linux-kernel

On 07/03/2024 17:29, Alan Stern wrote:
> On Thu, Mar 07, 2024 at 05:51:59PM +0100, Uwe Kleine-König wrote:
>> On Thu, Mar 07, 2024 at 10:51:35AM +0000, Colin Ian King wrote:
>>> The variable irqflags is being initialized and being bit-or'd with
>>> values but it is never read afterwards. The variable is redundant
>>> and can be removed.
>>>
>>> Cleans up clang scan build warning:
>>> drivers/usb/gadget/udc/net2272.c:2610:15: warning: variable 'irqflags'
>>> set but not used [-Wunused-but-set-variable]
>>>
>>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
>>
>> this "problem" exists since the driver was introduced in commit
>> ceb80363b2ec ("USB: net2272: driver for PLX NET2272 USB device
>> controller"). Might be worth a Fixes: line.
>>
>> I wonder if the better fix would be:
>>
>> diff --git a/drivers/usb/gadget/udc/net2272.c b/drivers/usb/gadget/udc/net2272.c
>> index 12e76bb62c20..19bbc38f3d35 100644
>> --- a/drivers/usb/gadget/udc/net2272.c
>> +++ b/drivers/usb/gadget/udc/net2272.c
>> @@ -2650,7 +2650,7 @@ net2272_plat_probe(struct platform_device *pdev)
>>   		goto err_req;
>>   	}
>>   
>> -	ret = net2272_probe_fin(dev, IRQF_TRIGGER_LOW);
>> +	ret = net2272_probe_fin(dev, irqflags);
>>   	if (ret)
>>   		goto err_io;
> 
> I agree, that makes much more sense.

OK, I'll send a V2, but I can't test it, so I suspect that is a risk, 
but it is clearly wrong as it stands.

Colin

> 
> Alan Stern


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

end of thread, other threads:[~2024-03-07 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 10:51 [PATCH][next] usb: gadget: net2272: remove redundant variable irqflags Colin Ian King
2024-03-07 16:51 ` Uwe Kleine-König
2024-03-07 17:29   ` Alan Stern
2024-03-07 17:46     ` Colin King (gmail)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).