Skip to contentSkip to conversation

serial: mctrl-gpio: fix build warning

PATCH New Arnd Bergmann 2 participants 2 messages Mar 11, 2015 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: mctrl-gpio: fix build warning

A recent fix to the error handling in this driver introduced a harmless warning:

serial/serial_mctrl_gpio.c: In function 'mctrl_gpio_init':
serial/serial_mctrl_gpio.c:110:4: warning: return makes pointer from integer without a cast serial/serial_mctrl_gpio.c:90:6: warning: unused variable 'err' [-Wunused-variable]

This removes the unused variable and uses the ERR_CAST helper to return the error value as the correct type.

Fixes 1d267ea6539f2 ("serial: mctrl-gpio: simplify init routine")
drivers/tty/serial/serial_mctrl_gpio.c +1 -2
index 5027db7b5814..0ec756c62bcf 100644
@@ -87,7 +87,6 @@ struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx)
 {
 	struct mctrl_gpios *gpios;
 	enum mctrl_gpio_idx i;
-	int err;
 
 	gpios = devm_kzalloc(dev, sizeof(*gpios), GFP_KERNEL);
 	if (!gpios)
@@ -107,7 +106,7 @@ struct mctrl_gpios *mctrl_gpio_init(struct device *dev, unsigned int idx)
 						      idx, flags);
 
 		if (IS_ERR(gpios->gpio[i]))
-			return PTR_ERR(gpios->gpio[i]);
+			return ERR_CAST(gpios->gpio[i]);
 	}
 
 	return gpios;
#1 lore raw

PATCH 1/1 serial: mctrl-gpio: fix build warning

Quoted 7 lines · Arnd Bergmann

A recent fix to the error handling in this driver introduced a harmless warning:

serial/serial_mctrl_gpio.c: In function 'mctrl_gpio_init':
serial/serial_mctrl_gpio.c:110:4: warning: return makes pointer from integer without a cast serial/serial_mctrl_gpio.c:90:6: warning: unused variable 'err' [-Wunused-variable]

Quoted 5 lines

This removes the unused variable and uses the ERR_CAST helper to return the error value as the correct type.

Fixes 1d267ea6539f2 ("serial: mctrl-gpio: simplify init routine")

Someone else sent me this before you did, sorry.

greg k-h