Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: max730x: Make __max730x_remove() return void

An spi or i2c remove callback is only called for devices that probed
successfully. In this case this implies that __max730x_probe() set a
non-NULL driver data. So the check ts == NULL is never true. With this
check dropped, __max730x_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

authored by

Uwe Kleine-König and committed by
Bartosz Golaszewski
06de2cd7 aa4858eb

+8 -8
+3 -1
drivers/gpio/gpio-max7300.c
··· 50 50 51 51 static int max7300_remove(struct i2c_client *client) 52 52 { 53 - return __max730x_remove(&client->dev); 53 + __max730x_remove(&client->dev); 54 + 55 + return 0; 54 56 } 55 57 56 58 static const struct i2c_device_id max7300_id[] = {
+3 -1
drivers/gpio/gpio-max7301.c
··· 66 66 67 67 static int max7301_remove(struct spi_device *spi) 68 68 { 69 - return __max730x_remove(&spi->dev); 69 + __max730x_remove(&spi->dev); 70 + 71 + return 0; 70 72 } 71 73 72 74 static const struct spi_device_id max7301_id[] = {
+1 -5
drivers/gpio/gpio-max730x.c
··· 220 220 } 221 221 EXPORT_SYMBOL_GPL(__max730x_probe); 222 222 223 - int __max730x_remove(struct device *dev) 223 + void __max730x_remove(struct device *dev) 224 224 { 225 225 struct max7301 *ts = dev_get_drvdata(dev); 226 - 227 - if (ts == NULL) 228 - return -ENODEV; 229 226 230 227 /* Power down the chip and disable IRQ output */ 231 228 ts->write(dev, 0x04, 0x00); 232 229 gpiochip_remove(&ts->chip); 233 230 mutex_destroy(&ts->lock); 234 - return 0; 235 231 } 236 232 EXPORT_SYMBOL_GPL(__max730x_remove); 237 233
+1 -1
include/linux/spi/max7301.h
··· 31 31 u32 input_pullup_active; 32 32 }; 33 33 34 - extern int __max730x_remove(struct device *dev); 34 + extern void __max730x_remove(struct device *dev); 35 35 extern int __max730x_probe(struct max7301 *ts); 36 36 #endif