Skip to contentSkip to conversation

usb: gadget: net2272: remove redundant variable irqflags

PATCH In review Colin Ian King 3 participants 4 messages Mar 7, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: gadget: net2272: remove redundant variable irqflags

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]

---
 drivers/usb/gadget/udc/net2272.c | 11 -----------
 1 file changed, 11 deletions(-)
drivers/usb/gadget/udc/net2272.c +0 -11
index 12e76bb62c20..afd2a836be6d 100644
@@ -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)
Signature · 1 line
2.39.2
#1 lore raw
Quoted 9 lines · Colin Ian King

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]

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:

drivers/usb/gadget/udc/net2272.c +1 -1
index 12e76bb62c20..19bbc38f3d35 100644
@@ -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

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#2 lore raw
Quoted 22 lines · Uwe Kleine-König
Quoted 9 lines · Colin Ian King

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]

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:

drivers/usb/gadget/udc/net2272.c +0 -0
index 12e76bb62c20..19bbc38f3d35 100644

drivers/usb/gadget/udc/net2272.c net2272_plat_probe(struct platform_device *pdev) · line 2655

Quoted 7 lines
drivers/usb/gadget/udc/net2272.c +1 -1
@@ -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

#3 lore raw
Quoted 26 lines · Alan Stern
Quoted 25 lines · Uwe Kleine-König
Quoted 9 lines · Colin Ian King

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]

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:

drivers/usb/gadget/udc/net2272.c +0 -0
index 12e76bb62c20..19bbc38f3d35 100644
@@ -2650,7 +2650,7 @@ net2272_plat_probe(struct platform_device *pdev)
  		goto err_req;
  	}
 
Quoted 6 lines

drivers/usb/gadget/udc/net2272.c net2272_plat_probe(struct platform_device *pdev) · line 2655

Quoted 4 lines
drivers/usb/gadget/udc/net2272.c +1 -1
-	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

Quoted 2 lines

Alan Stern