Skip to content

Commit 06de2cd

Browse files
Uwe Kleine-Königbrgl
authored andcommitted
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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent aa4858e commit 06de2cd

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

drivers/gpio/gpio-max7300.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ static int max7300_probe(struct i2c_client *client,
5050

5151
static int max7300_remove(struct i2c_client *client)
5252
{
53-
return __max730x_remove(&client->dev);
53+
__max730x_remove(&client->dev);
54+
55+
return 0;
5456
}
5557

5658
static const struct i2c_device_id max7300_id[] = {

drivers/gpio/gpio-max7301.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ static int max7301_probe(struct spi_device *spi)
6666

6767
static int max7301_remove(struct spi_device *spi)
6868
{
69-
return __max730x_remove(&spi->dev);
69+
__max730x_remove(&spi->dev);
70+
71+
return 0;
7072
}
7173

7274
static const struct spi_device_id max7301_id[] = {

drivers/gpio/gpio-max730x.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,14 @@ int __max730x_probe(struct max7301 *ts)
220220
}
221221
EXPORT_SYMBOL_GPL(__max730x_probe);
222222

223-
int __max730x_remove(struct device *dev)
223+
void __max730x_remove(struct device *dev)
224224
{
225225
struct max7301 *ts = dev_get_drvdata(dev);
226226

227-
if (ts == NULL)
228-
return -ENODEV;
229-
230227
/* Power down the chip and disable IRQ output */
231228
ts->write(dev, 0x04, 0x00);
232229
gpiochip_remove(&ts->chip);
233230
mutex_destroy(&ts->lock);
234-
return 0;
235231
}
236232
EXPORT_SYMBOL_GPL(__max730x_remove);
237233

include/linux/spi/max7301.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ struct max7301_platform_data {
3131
u32 input_pullup_active;
3232
};
3333

34-
extern int __max730x_remove(struct device *dev);
34+
extern void __max730x_remove(struct device *dev);
3535
extern int __max730x_probe(struct max7301 *ts);
3636
#endif

0 commit comments

Comments
 (0)