Skip to contentSkip to conversation

ARM: OMAP: OTG integration: fix compiler warning

PATCH New Paul Walmsley 2 participants 2 messages May 9, 2012 – May 11, 2012

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

PATCH 1/1 ARM: OMAP: OTG integration: fix compiler warning

Tony reported the following compile warning after commit eeb3711b89d68e147e05e7b43a49ecc5009dc157 ("ARM: OMAP2+: clean up some cppcheck warnings"):

arch/arm/plat-omap/usb.c: In function 'omap_otg_init':
arch/arm/plat-omap/usb.c:40: warning: unused variable 'status'

This happens if CONFIG_ARCH_OMAP_OTG is set but CONFIG_USB_GADGET_OMAP, CONFIG_USB_OHCI_HCD, CONFIG_USB_OHCI_HCD_MODULE, and CONFIG_USB_OTG are all unset.

Fix by localizing the status variable to the blocks that use it.

Compile-tested only, with omap2plus_defconfig and omap2plus_defconfig with CONFIG_USB_OHCI_HCD and CONFIG_USB_OTG enabled.

---
Applies after eeb3711b89d68e147e05e7b43a49ecc5009dc157.

 arch/arm/plat-omap/usb.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/plat-omap/usb.c +3 -1
index 5db7561..daa0327 100644
@@ -37,7 +37,6 @@ void __init
 omap_otg_init(struct omap_usb_config *config)
 {
 	u32		syscon;
-	int		status;
 	int		alt_pingroup = 0;
 
 	/* NOTE:  no bus or clock setup (yet?) */
@@ -102,6 +101,7 @@ omap_otg_init(struct omap_usb_config *config)
 #ifdef	CONFIG_USB_GADGET_OMAP
 	if (config->otg || config->register_dev) {
 		struct platform_device *udc_device = config->udc_device;
+		int status;
 
 		syscon &= ~DEV_IDLE_EN;
 		udc_device->dev.platform_data = config;
@@ -114,6 +114,7 @@ omap_otg_init(struct omap_usb_config *config)
 #if	defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
 	if (config->otg || config->register_host) {
 		struct platform_device *ohci_device = config->ohci_device;
+		int status;
 
 		syscon &= ~HST_IDLE_EN;
 		ohci_device->dev.platform_data = config;
@@ -126,6 +127,7 @@ omap_otg_init(struct omap_usb_config *config)
 #ifdef	CONFIG_USB_OTG
 	if (config->otg) {
 		struct platform_device *otg_device = config->otg_device;
+		int status;
 
 		syscon &= ~OTG_IDLE_EN;
 		otg_device->dev.platform_data = config;
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/1 ARM: OMAP: OTG integration: fix compiler warning

Quoted 8 lines · Paul Walmsley

Tony reported the following compile warning after commit eeb3711b89d68e147e05e7b43a49ecc5009dc157 ("ARM: OMAP2+: clean up some cppcheck warnings"):

arch/arm/plat-omap/usb.c: In function 'omap_otg_init':
arch/arm/plat-omap/usb.c:40: warning: unused variable 'status'

Quoted 8 lines

This happens if CONFIG_ARCH_OMAP_OTG is set but CONFIG_USB_GADGET_OMAP, CONFIG_USB_OHCI_HCD, CONFIG_USB_OHCI_HCD_MODULE, and CONFIG_USB_OTG are all unset.

Fix by localizing the status variable to the blocks that use it.

Compile-tested only, with omap2plus_defconfig and omap2plus_defconfig with CONFIG_USB_OHCI_HCD and CONFIG_USB_OTG enabled.

Thanks applying into fixes-for-cleanup branch.

Tony