Skip to contentSkip to conversation

usb: gadget: bcm63xx_udc:remove redundant variable assignment

PATCH NAK Tang Bin 2 participants 3 messages Mar 24, 2020

Subsystems (2)
lore
Share & tools
lore

Tang Bin

author
#0 lore raw

PATCH v2 1/1 usb: gadget: bcm63xx_udc:remove redundant variable assignment

--v1------------------------------------
In this function, the variable 'rc' is assigned after this place, so the definition is invalid.

--v2------------------------------------
In this function, the variable 'rc' will be assigned by the function 'usb_add_gadget_udc()',so the assignment here is redundant,we should remove it.

---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/gadget/udc/bcm63xx_udc.c +0 -2
index 54501814d..a7afa8c35 100644
@@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
-
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
Signature · 9 lines
2.20.1.windows.1




_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw

Hello!

Quoted 10 lines · Tang Bin

--v1------------------------------------
In this function, the variable 'rc' is assigned after this place, so the definition is invalid.

--v2------------------------------------
In this function, the variable 'rc' will be assigned by the function 'usb_add_gadget_udc()',so the assignment here is redundant,we should remove it.

NAK.

Quoted 9 lines
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/gadget/udc/bcm63xx_udc.c +0 -0
index 54501814d..a7afa8c35 100644

drivers/usb/gadget/udc/bcm63xx_udc.c static int bcm63xx_udc_probe(struct platform_device *pdev) · line 2326

Quoted 8 lines
drivers/usb/gadget/udc/bcm63xx_udc.c +0 -2
@@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
-	rc = -ENXIO;
-
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)

This *if* branch goes to the 'out_uninit' label which uses 'rc' (and it should
be negative).
In principle, if you change 'rc' to 'irq' below, this patch would be sane.
It's not as is.

MBR, Sergei

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#2 lore raw
Quoted 25 lines · Sergei Shtylyov
Quoted 10 lines

--v1------------------------------------
In this function, the variable 'rc' is assigned after this place, so the definition is invalid.

--v2------------------------------------
In this function, the variable 'rc' will be assigned by the function 'usb_add_gadget_udc()',so the assignment here is redundant,we should remove it.

NAK.

Quoted 12 lines
---
 drivers/usb/gadget/udc/bcm63xx_udc.c | 2 --
 1 file changed, 2 deletions(-)
drivers/usb/gadget/udc/bcm63xx_udc.c +0 -0
index 54501814d..a7afa8c35 100644
@@ -2321,8 +2321,6 @@ static int bcm63xx_udc_probe(struct platform_device *pdev)
 	if (rc)
 		return rc;
 
Quoted 10 lines

drivers/usb/gadget/udc/bcm63xx_udc.c static int bcm63xx_udc_probe(struct platform_device *pdev) · line 2326

Quoted 5 lines
drivers/usb/gadget/udc/bcm63xx_udc.c +0 -2
-	rc = -ENXIO;
-
 	/* IRQ resource #0: control interrupt (VBUS, speed, etc.) */
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)

This *if* branch goes to the 'out_uninit' label which uses 'rc' (and it should
be negative).
In principle, if you change 'rc' to 'irq' below, this patch would be sane.
It's not as is.

Still, the other *goto* out_uninit in te loop below shoild be changed as well.
Otherwise, if the result is overriden to -ENXIO, e.g. deferred probing is borked.

MBR, Sergei