Make some spi device drivers return zero in .remove()
Subsystems (24)
v2 cover Make some spi device drivers return zero in .remove()
Hello,
this is v2 of my quest to make spi remove callbacks return void. Today they return an int, but the only result of returning a non-zero value is a warning message. So it's a bad idea to return an error code in the expectation that not freeing some resources is ok then. The same holds true for i2c and platform devices which benefit en passant for a few drivers.
The patches in this series address some of the spi drivers that might return non-zero and adapt them accordingly to return zero instead. For most drivers it's just about not hiding the fact that they already return zero.
Given that there are quite some more patches of this type to create before I can change the spi remove callback, I suggest the respective subsystem maintainers pick up these patches. There are no interdependencies in this series.
Compared to (implicit) v1
- I fixed a few compiler issues (this series it build tested with an allmoddefconfig on arm64, m68k, powerpc, riscv, s390, sparc64 and x86_64).
- A few new patches (2x gpio, 2x misc, 4x mtd)
- One patch already landed in next, this one I dropped. The drm/panel patch as claimed to applied, too, but not yet in next. It's included here, but I assume I was just too impatient and this one should be ignored.
Full range-diff below.
Best regards
Uwe
Uwe Kleine-König (20):
drm/panel: s6e63m0: Make s6e63m0_remove() return void
gpio: max730x: Make __max730x_remove() return void
gpio: mc33880: Drop if with an always false condition
hwmon: max31722: Warn about failure to put device in stand-by in
.remove()
input: adxl34xx: Make adxl34x_remove() return void
input: touchscreen: tsc200x: Make tsc200x_remove() return void
media: cxd2880: Eliminate dead code
mfd: mc13xxx: Make mc13xxx_common_exit() return void
mfd: stmpe: Make stmpe_remove() return void
mfd: tps65912: Make tps65912_device_exit() return void
misc: ad525x_dpot: Make ad_dpot_remove() return void
misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
mtd: dataflash: Warn about failure to unregister mtd device
mtd: mchp23k256: Warn about failure to unregister mtd device
mtd: mchp48l640: Warn about failure to unregister mtd device
mtd: sst25l: Warn about failure to unregister mtd device
serial: max310x: Make max310x_remove() return void
serial: sc16is7xx: Make sc16is7xx_remove() return void
staging: fbtft: Make fbtft_remove_common() return void
tpm: st33zp24: Make st33zp24_remove() return void
drivers/char/tpm/st33zp24/i2c.c | 5 +---- drivers/char/tpm/st33zp24/spi.c | 5 +---- drivers/char/tpm/st33zp24/st33zp24.c | 3 +-- drivers/char/tpm/st33zp24/st33zp24.h | 2 +- drivers/gpio/gpio-max7300.c | 4 +++- drivers/gpio/gpio-max7301.c | 4 +++- drivers/gpio/gpio-max730x.c | 6 +----- drivers/gpio/gpio-mc33880.c | 2 -- drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 4 +--- drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 2 +- drivers/hwmon/max31722.c | 8 +++++++- drivers/input/misc/adxl34x-i2c.c | 4 +++- drivers/input/misc/adxl34x-spi.c | 4 +++- drivers/input/misc/adxl34x.c | 4 +--- drivers/input/misc/adxl34x.h | 2 +- drivers/input/touchscreen/tsc2004.c | 4 +++- drivers/input/touchscreen/tsc2005.c | 4 +++- drivers/input/touchscreen/tsc200x-core.c | 4 +--- drivers/input/touchscreen/tsc200x-core.h | 2 +- drivers/media/spi/cxd2880-spi.c | 13 +------------ drivers/mfd/mc13xxx-core.c | 4 +--- drivers/mfd/mc13xxx-i2c.c | 3 ++- drivers/mfd/mc13xxx-spi.c | 3 ++- drivers/mfd/mc13xxx.h | 2 +- drivers/mfd/stmpe-i2c.c | 4 +++- drivers/mfd/stmpe-spi.c | 4 +++- drivers/mfd/stmpe.c | 4 +--- drivers/mfd/stmpe.h | 2 +- drivers/mfd/tps65912-core.c | 4 +--- drivers/mfd/tps65912-i2c.c | 4 +++- drivers/mfd/tps65912-spi.c | 4 +++- drivers/misc/ad525x_dpot-i2c.c | 3 ++- drivers/misc/ad525x_dpot-spi.c | 3 ++- drivers/misc/ad525x_dpot.c | 4 +--- drivers/misc/ad525x_dpot.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d.c | 3 +-- drivers/misc/lis3lv02d/lis3lv02d.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d_spi.c | 4 +++- drivers/mtd/devices/mchp23k256.c | 9 ++++++++- drivers/mtd/devices/mchp48l640.c | 8 +++++++- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- drivers/mtd/devices/sst25l.c | 8 +++++++- drivers/platform/x86/hp_accel.c | 3 ++- drivers/staging/fbtft/fbtft-core.c | 8 +------- drivers/staging/fbtft/fbtft.h | 8 +++++--- drivers/tty/serial/max310x.c | 7 +++---- drivers/tty/serial/sc16is7xx.c | 12 +++++++----- include/linux/mfd/tps65912.h | 2 +- include/linux/spi/max7301.h | 2 +- 51 files changed, 119 insertions(+), 104 deletions(-)
Range-diff against v1:
1: 73a1a54d9ea0 = 1: 87fd7940fbfd drm/panel: s6e63m0: Make s6e63m0_remove() return void 2: 3bcc8e8bd1a3 < -: ------------ hwmon: adt7x10: Make adt7x10_remove() return void -: ------------ > 2: 305311d63bbb gpio: max730x: Make __max730x_remove() return void -: ------------ > 3: 0cafc31ea5c5 gpio: mc33880: Drop if with an always false condition 3: 07f067732aa9 ! 4: f39467b50f06 hwmon: max31722: Warn about failure to put device in stand-by in .remove()
@@ Commit message
nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
- Signed-off-by: Uwe Kleine-König <[email protected]>
+ Signed-off-by: Uwe Kleine-König <[email protected]>
## drivers/hwmon/max31722.c ##
@@ drivers/hwmon/max31722.c: static int max31722_probe(struct spi_device *spi)
4: 0b0a5497d105 = 5: de3a78214008 input: adxl34xx: Make adxl34x_remove() return void
5: 0d4f14bc2dd6 ! 6: 9629ac3f9e13 input: touchscreen: tsc200x: Make tsc200x_remove() return void
@@ drivers/input/touchscreen/tsc2005.c: static int tsc2005_probe(struct spi_device
- return tsc200x_remove(&spi->dev);
+ tsc200x_remove(&spi->dev);
+
-+ return 0
++ return 0;
}
#ifdef CONFIG_OF
6: a68bbd23223b = 7: 1aab41df9262 media: cxd2880: Eliminate dead code
7: 3801b37ac18f ! 8: 745d1a5f840e mfd: mc13xxx: Make mc13xxx_common_exit() return void
@@ drivers/mfd/mc13xxx-spi.c: static int mc13xxx_spi_probe(struct spi_device *spi)
{
- return mc13xxx_common_exit(&spi->dev);
+ mc13xxx_common_exit(&spi->dev);
-+ return 0
++ return 0;
}
static struct spi_driver mc13xxx_spi_driver = {
8: 22159093ce71 = 9: 7ee04277db66 mfd: stmpe: Make stmpe_remove() return void
9: f91da216c752 = 10: 4a21c90a57f8 mfd: tps65912: Make tps65912_device_exit() return void
-: ------------ > 11: f92aa824fd1c misc: ad525x_dpot: Make ad_dpot_remove() return void
-: ------------ > 12: 5b2fccd09a24 misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
-: ------------ > 13: 609ab18323fc mtd: dataflash: Warn about failure to unregister mtd device
-: ------------ > 14: 3b220d5fa547 mtd: mchp23k256: Warn about failure to unregister mtd device
-: ------------ > 15: baf6f4b3a8c7 mtd: mchp48l640: Warn about failure to unregister mtd device
-: ------------ > 16: edf3788a30b0 mtd: sst25l: Warn about failure to unregister mtd device
10: f2def77b74d1 ! 17: 614f7c001377 serial: max310x: Make max310x_remove() return void
@@ drivers/tty/serial/max310x.c: static int max310x_spi_probe(struct spi_device *sp
{
- return max310x_remove(&spi->dev);
+ max310x_remove(&spi->dev);
-+ return 0
++ return 0;
}
static const struct spi_device_id max310x_id_table[] = {11: 283e4bbeff38 ! 18: 35d1f5b36de5 serial: sc16is7xx: Make sc16is7xx_remove() return void
@@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_probe(struct device *dev,
{
struct sc16is7xx_port *s = dev_get_drvdata(dev);
int i;
+@@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_remove(struct device *dev)
+ kthread_stop(s->kworker_task);
+
+ clk_disable_unprepare(s->clk);
+-
+- return 0;
+ }
+
+ static const struct of_device_id __maybe_unused sc16is7xx_dt_ids[] = {
@@ drivers/tty/serial/sc16is7xx.c: static int sc16is7xx_spi_probe(struct spi_device *spi)
static int sc16is7xx_spi_remove(struct spi_device *spi)
12: 5093fbdceee5 ! 19: d9ec9a96fbb8 staging: fbtft: Make fbtft_remove_common() return void
@@ drivers/staging/fbtft/fbtft-core.c: EXPORT_SYMBOL(fbtft_probe_common);
## drivers/staging/fbtft/fbtft.h ##
+@@ drivers/staging/fbtft/fbtft.h: void fbtft_unregister_backlight(struct fbtft_par *par);
+ int fbtft_init_display(struct fbtft_par *par);
+ int fbtft_probe_common(struct fbtft_display *display, struct spi_device *sdev,
+ struct platform_device *pdev);
+-int fbtft_remove_common(struct device *dev, struct fb_info *info);
++void fbtft_remove_common(struct device *dev, struct fb_info *info);
+
+ /* fbtft-io.c */
+ int fbtft_write_spi(struct fbtft_par *par, void *buf, size_t len);
@@ drivers/staging/fbtft/fbtft.h: static int fbtft_driver_remove_spi(struct spi_device *spi) \
{ \
struct fb_info *info = spi_get_drvdata(spi); \13: 9156e6380a5e = 20: 89d0b85968a9 tpm: st33zp24: Make st33zp24_remove() return void
base-commit: 9e1ff307c779ce1f0f810c7ecce3d95bbae40896
Signature · 1 line
2.30.2
PATCH v2 1/20 drm/panel: s6e63m0: Make s6e63m0_remove() return void
Up to now s6e63m0_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 spi remove callbacks is ignored anyway.
--- drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c | 3 ++- drivers/gpu/drm/panel/panel-samsung-s6e63m0.c | 4 +--- drivers/gpu/drm/panel/panel-samsung-s6e63m0.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c +2 -1
@@ -116,7 +116,8 @@ static int s6e63m0_dsi_probe(struct mipi_dsi_device *dsi)static int s6e63m0_dsi_remove (struct mipi_dsi_device *dsi) {mipi_dsi_detach (dsi); -return s6e63m0_remove (&dsi->dev); +s6e63m0_remove (&dsi->dev); +return 0 ; }static const struct of_device_id s6e63m0_dsi_of_match[] = {
drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c +2 -1
@@ -64,7 +64,8 @@ static int s6e63m0_spi_probe(struct spi_device *spi)static int s6e63m0_spi_remove (struct spi_device *spi) { -return s6e63m0_remove (&spi->dev); +s6e63m0_remove (&spi->dev); +return 0 ; }static const struct of_device_id s6e63m0_spi_of_match[] = {
drivers/gpu/drm/panel/panel-samsung-s6e63m0.c +1 -3
@@ -749,13 +749,11 @@ int s6e63m0_probe(struct device *dev, void *trsp, }EXPORT_SYMBOL_GPL (s6e63m0_probe); -int s6e63m0_remove (struct device *dev) +void s6e63m0_remove (struct device *dev) {struct s6e63m0 *ctx =dev_get_drvdata (dev);drm_panel_remove (&ctx->panel); - -return 0 ; }EXPORT_SYMBOL_GPL (s6e63m0_remove);
drivers/gpu/drm/panel/panel-samsung-s6e63m0.h +1 -1
@@ -35,6 +35,6 @@ int s6e63m0_probe(struct device *dev, void *trsp,const u8 *data, size_t len), bool dsi_mode); -int s6e63m0_remove (struct device *dev); +void s6e63m0_remove (struct device *dev);#endif /* _PANEL_SAMSUNG_S6E63M0_H */
Signature · 1 line
2.30.2
PATCH v2 2/20 gpio: max730x: Make __max730x_remove() return void
In reply to Uwe Kleine-KönigAn 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.
--- drivers/gpio/gpio-max7300.c | 4 +++- drivers/gpio/gpio-max7301.c | 4 +++- drivers/gpio/gpio-max730x.c | 6 +----- include/linux/spi/max7301.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/gpio/gpio-max7300.c +3 -1
@@ -50,7 +50,9 @@ static int max7300_probe(struct i2c_client *client,static int max7300_remove (struct i2c_client *client) { -return __max730x_remove (&client->dev); +__max730x_remove (&client->dev); + +return 0 ; }static const struct i2c_device_id max7300_id[] = {
drivers/gpio/gpio-max7301.c +3 -1
@@ -66,7 +66,9 @@ static int max7301_probe(struct spi_device *spi)static int max7301_remove (struct spi_device *spi) { -return __max730x_remove (&spi->dev); +__max730x_remove (&spi->dev); + +return 0 ; }static const struct spi_device_id max7301_id[] = {
drivers/gpio/gpio-max730x.c +1 -5
@@ -220,18 +220,14 @@ int __max730x_probe(struct max7301 *ts) }EXPORT_SYMBOL_GPL (__max730x_probe); -int __max730x_remove (struct device *dev) +void __max730x_remove (struct device *dev) {struct max7301 *ts =dev_get_drvdata (dev); -if (ts ==NULL ) -return -ENODEV ; -/* Power down the chip and disable IRQ output */ ts->write (dev,0x04 ,0x00 );gpiochip_remove (&ts->chip);mutex_destroy (&ts->lock); -return 0 ; }EXPORT_SYMBOL_GPL (__max730x_remove);
include/linux/spi/max7301.h +1 -1
@@ -31,6 +31,6 @@ struct max7301_platform_data { u32 input_pullup_active; }; -extern int __max730x_remove (struct device *dev); +extern void __max730x_remove (struct device *dev);extern int __max730x_probe (struct max7301 *ts);#endif
Signature · 1 line
2.30.2
Bartosz Golaszewski
AppliedRe: [PATCH v2 02/20] gpio: max730x: Make __max730x_remove() return void
Quoted 8 lines · Uwe Kleine-König
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.
Quoted 4 lines
Also the return value of i2c and spi remove callbacks is ignored anyway.
Signed-off-by Uwe Kleine-König <[email protected]>---
Applied, thanks!
Bart
PATCH v2 3/20 gpio: mc33880: Drop if with an always false condition
In reply to Uwe Kleine-KönigAn spi remove callback is only called for devices that probed successfully. In this case this implies that mc33880_probe() set a non-NULL driver data. So the check for mc being NULL is never true and the check can be dropped.
Also the return value ofspi remove callbacks is ignored anyway.
--- drivers/gpio/gpio-mc33880.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpio/gpio-mc33880.c +0 -2
@@ -139,8 +139,6 @@ static int mc33880_remove(struct spi_device *spi)struct mc33880 *mc; mc =spi_get_drvdata (spi); -if (!mc) -return -ENODEV ;gpiochip_remove (&mc->chip);mutex_destroy (&mc->lock);
Signature · 1 line
2.30.2
Bartosz Golaszewski
AppliedRe: [PATCH v2 03/20] gpio: mc33880: Drop if with an always false condition
Quoted 27 lines · Uwe Kleine-König
An spi remove callback is only called for devices that probed successfully. In this case this implies that
mc33880_probe()set a non-NULL driver data. So the check for mc being NULL is never true and the check can be dropped.Also the return value ofspi remove callbacks is ignored anyway.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/gpio/gpio-mc33880.c | 2 -- 1 file changed, 2 deletions(-)drivers/gpio/gpio-mc33880.c +0
-3@@ -139,8 +139,6 @@ static int mc33880_remove(struct spi_device *spi)struct mc33880 *mc; mc =spi_get_drvdata (spi); -if (!mc) -return -ENODEV ;gpiochip_remove (&mc->chip);mutex_destroy (&mc->lock); --
Quoted 2 lines
2.30.2
Applied, thanks!
Bart
PATCH v2 4/20 hwmon: max31722: Warn about failure to put device in stand-by in .remove()
In reply to Uwe Kleine-KönigWhen an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
--- drivers/hwmon/max31722.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/hwmon/max31722.c +7 -1
@@ -103,10 +103,16 @@ static int max31722_probe(struct spi_device *spi)static int max31722_remove (struct spi_device *spi) {struct max31722_data *data =spi_get_drvdata (spi); +int ret;hwmon_device_unregister (data->hwmon_dev); -return max31722_set_mode (data,MAX31722_MODE_STANDBY ); + ret =max31722_set_mode (data,MAX31722_MODE_STANDBY ); +if (ret) +/* There is nothing we can do about this ... */ +dev_warn (&spi->dev,"Failed to put device in stand-by mode\n" ); + +return 0 ; }static int __maybe_unused max31722_suspend (struct device *dev)
Signature · 1 line
2.30.2
Re: [PATCH v2 04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove()
Quoted 6 lines · Uwe Kleine-König
When an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
Signed-off-by Uwe Kleine-König <[email protected]>
Applied to hwmon-next.
Thanks,
Guenter
Quoted 26 lines
--- drivers/hwmon/max31722.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)drivers/hwmon/max31722.c +7
-1@@ -103,10 +103,16 @@ static int max31722_probe(struct spi_device *spi)static int max31722_remove (struct spi_device *spi) {struct max31722_data *data =spi_get_drvdata (spi); +int ret;hwmon_device_unregister (data->hwmon_dev); -return max31722_set_mode (data,MAX31722_MODE_STANDBY ); + ret =max31722_set_mode (data,MAX31722_MODE_STANDBY ); +if (ret) +/* There is nothing we can do about this ... */ +dev_warn (&spi->dev,"Failed to put device in stand-by mode\n" ); + +return 0 ; }static int __maybe_unused max31722_suspend (struct device *dev)
PATCH v2 5/20 input: adxl34xx: Make adxl34x_remove() return void
In reply to Uwe Kleine-KönigUp to now adxl34x_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.
--- drivers/input/misc/adxl34x-i2c.c | 4 +++- drivers/input/misc/adxl34x-spi.c | 4 +++- drivers/input/misc/adxl34x.c | 4 +--- drivers/input/misc/adxl34x.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/input/misc/adxl34x-i2c.c +3 -1
@@ -103,7 +103,9 @@ static int adxl34x_i2c_remove(struct i2c_client *client) {struct adxl34x *ac =i2c_get_clientdata (client); -return adxl34x_remove (ac); +adxl34x_remove (ac); + +return 0 ; }static int __maybe_unused adxl34x_i2c_suspend (struct device *dev)
drivers/input/misc/adxl34x-spi.c +3 -1
@@ -91,7 +91,9 @@ static int adxl34x_spi_remove(struct spi_device *spi) {struct adxl34x *ac =spi_get_drvdata (spi); -return adxl34x_remove (ac); +adxl34x_remove (ac); + +return 0 ; }static int __maybe_unused adxl34x_spi_suspend (struct device *dev)
drivers/input/misc/adxl34x.c +1 -3
@@ -896,15 +896,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, }EXPORT_SYMBOL_GPL (adxl34x_probe); -int adxl34x_remove (struct adxl34x *ac) +void adxl34x_remove (struct adxl34x *ac) {sysfs_remove_group (&ac->dev->kobj, &adxl34x_attr_group);free_irq (ac->irq, ac);input_unregister_device (ac->input);dev_dbg (ac->dev,"unregistered accelerometer\n" );kfree (ac); - -return 0 ; }EXPORT_SYMBOL_GPL (adxl34x_remove);
drivers/input/misc/adxl34x.h +1 -1
@@ -25,6 +25,6 @@ void adxl34x_resume(struct adxl34x *ac);struct adxl34x *adxl34x_probe (struct device *dev,int irq,bool fifo_delay_default,const struct adxl34x_bus_ops *bops); -int adxl34x_remove (struct adxl34x *ac); +void adxl34x_remove (struct adxl34x *ac);#endif
Signature · 1 line
2.30.2
Re: [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
Quoted 7 lines · Uwe Kleine-König
Up to now
adxl34x_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]>
Applied, thank you.
Signature · 1 line
Dmitry
RE: [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
In reply to Uwe Kleine-KönigQuoted 11 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Dienstag, 12. Oktober 2021 17:40
To: Dmitry Torokhov <[email protected]>; Hennerich, Michael <[email protected]>
Cc: Mark Brown <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH v2 05/20] input: adxl34xx: Makeadxl34x_remove()return void
Quoted 7 lines
Up to now
adxl34x_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]>
Quoted 70 lines
--- drivers/input/misc/adxl34x-i2c.c | 4 +++- drivers/input/misc/adxl34x-spi.c | 4 +++- drivers/input/misc/adxl34x.c | 4 +--- drivers/input/misc/adxl34x.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)drivers/input/misc/adxl34x-i2c.c +3
-1@@ -103,7 +103,9 @@ static int adxl34x_i2c_remove(struct i2c_client *client) {struct adxl34x *ac =i2c_get_clientdata (client); -return adxl34x_remove (ac); +adxl34x_remove (ac); + +return 0 ; } static int __maybe_unused adxl34x_i2c_suspend(struct device *dev) diff --git
a/drivers/input/misc/adxl34x-spi.cb/drivers/input/misc/adxl34x-spi.cindexdf6afa455e46..6e51c9bc619f100644drivers/input/misc/adxl34x-spi.c +3
-1@@ -91,7 +91,9 @@ static int adxl34x_spi_remove(struct spi_device *spi) {struct adxl34x *ac =spi_get_drvdata (spi); -return adxl34x_remove (ac); +adxl34x_remove (ac); + +return 0 ; } static int __maybe_unused adxl34x_spi_suspend(struct device *dev) diff --git
a/drivers/input/misc/adxl34x.cb/drivers/input/misc/adxl34x.cindex4cc4e8ff42b3..34beac80e6f0100644drivers/input/misc/adxl34x.c +1
-3@@ -896,15 +896,13 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq, } EXPORT_SYMBOL_GPL(adxl34x_probe); -int adxl34x_remove (struct adxl34x *ac) +void adxl34x_remove (struct adxl34x *ac) {sysfs_remove_group (&ac->dev->kobj, &adxl34x_attr_group);free_irq (ac->irq, ac);input_unregister_device (ac->input);dev_dbg (ac->dev,"unregistered accelerometer\n" );kfree (ac); - -return 0 ; }EXPORT_SYMBOL_GPL (adxl34x_remove);drivers/input/misc/adxl34x.h index renamed from drivers/input/misc/adxl34x.h +0
-0
83a0eeccf613..febf85270fff100644drivers/input/misc/adxl34x.h +1
-1@@ -25,6 +25,6 @@ void adxl34x_resume(struct adxl34x *ac); struct adxl34x *adxl34x_probe(struct device *dev, int irq, bool fifo_delay_default, const struct adxl34x_bus_ops *bops); -int adxl34x_remove(struct adxl34x *ac); +void adxl34x_remove (struct adxl34x *ac);#endif --2.30.2
PATCH v2 6/20 input: touchscreen: tsc200x: Make tsc200x_remove() return void
In reply to Uwe Kleine-KönigUp to now tsc200x_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.
--- drivers/input/touchscreen/tsc2004.c | 4 +++- drivers/input/touchscreen/tsc2005.c | 4 +++- drivers/input/touchscreen/tsc200x-core.c | 4 +--- drivers/input/touchscreen/tsc200x-core.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/input/touchscreen/tsc2004.c +3 -1
@@ -45,7 +45,9 @@ static int tsc2004_probe(struct i2c_client *i2c,static int tsc2004_remove (struct i2c_client *i2c) { -return tsc200x_remove (&i2c->dev); +tsc200x_remove (&i2c->dev); + +return 0 ; }static const struct i2c_device_id tsc2004_idtable[] = {
drivers/input/touchscreen/tsc2005.c +3 -1
@@ -66,7 +66,9 @@ static int tsc2005_probe(struct spi_device *spi)static int tsc2005_remove (struct spi_device *spi) { -return tsc200x_remove (&spi->dev); +tsc200x_remove (&spi->dev); + +return 0 ; }#ifdef CONFIG_OF
drivers/input/touchscreen/tsc200x-core.c +1 -3
@@ -577,15 +577,13 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, }EXPORT_SYMBOL_GPL (tsc200x_probe); -int tsc200x_remove (struct device *dev) +void tsc200x_remove (struct device *dev) {struct tsc200x *ts =dev_get_drvdata (dev);sysfs_remove_group (&dev->kobj, &tsc200x_attr_group);regulator_disable (ts->vio); - -return 0 ; }EXPORT_SYMBOL_GPL (tsc200x_remove);
drivers/input/touchscreen/tsc200x-core.h +1 -1
@@ -74,6 +74,6 @@ extern const struct dev_pm_ops tsc200x_pm_ops;int tsc200x_probe (struct device *dev,int irq,const struct input_id *tsc_id,struct regmap *regmap,int (*tsc200x_cmd)(struct device *dev,u8 cmd)); -int tsc200x_remove (struct device *dev); +void tsc200x_remove (struct device *dev);#endif
Signature · 1 line
2.30.2
Re: [PATCH v2 06/20] input: touchscreen: tsc200x: Make tsc200x_remove() return void
Quoted 7 lines · Uwe Kleine-König
Up to now
tsc200x_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]>
Applied, thank you.
Signature · 1 line
Dmitry
PATCH v2 7/20 media: cxd2880: Eliminate dead code
In reply to Uwe Kleine-KönigAn spi remove callback is never called with an spi_device pointer that is NULL. Also it is only called for devices that probed successfully. As cxd2880_spi_probe() always sets driver data, spi_get_drvdata() cannot be NULL.
Also the return value of spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea.
--- drivers/media/spi/cxd2880-spi.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/spi/cxd2880-spi.c +1 -12
@@ -628,19 +628,8 @@ cxd2880_spi_probe(struct spi_device *spi)static int cxd2880_spi_remove (struct spi_device *spi) { -struct cxd2880_dvb_spi *dvb_spi; +struct cxd2880_dvb_spi *dvb_spi =spi_get_drvdata (spi); -if (!spi) { -pr_err ("invalid arg\n" ); -return -EINVAL ; - } - - dvb_spi =spi_get_drvdata (spi); - -if (!dvb_spi) { -pr_err ("failed\n" ); -return -EINVAL ; - } dvb_spi->demux.dmx.remove_frontend (&dvb_spi->demux.dmx, &dvb_spi->dmx_fe);dvb_dmxdev_release (&dvb_spi->dmxdev);
Signature · 1 line
2.30.2
PATCH v2 8/20 mfd: mc13xxx: Make mc13xxx_common_exit() return void
In reply to Uwe Kleine-KönigUp to now mc13xxx_common_exit() 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.
--- drivers/mfd/mc13xxx-core.c | 4 +--- drivers/mfd/mc13xxx-i2c.c | 3 ++- drivers/mfd/mc13xxx-spi.c | 3 ++- drivers/mfd/mc13xxx.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/mfd/mc13xxx-core.c +1 -3
@@ -496,15 +496,13 @@ int mc13xxx_common_init(struct device *dev) }EXPORT_SYMBOL_GPL (mc13xxx_common_init); -int mc13xxx_common_exit (struct device *dev) +void mc13xxx_common_exit (struct device *dev) {struct mc13xxx *mc13xxx =dev_get_drvdata (dev);mfd_remove_devices (dev);regmap_del_irq_chip (mc13xxx->irq, mc13xxx->irq_data);mutex_destroy (&mc13xxx->lock); - -return 0 ; }EXPORT_SYMBOL_GPL (mc13xxx_common_exit);
drivers/mfd/mc13xxx-i2c.c +2 -1
@@ -87,7 +87,8 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,static int mc13xxx_i2c_remove (struct i2c_client *client) { -return mc13xxx_common_exit (&client->dev); +mc13xxx_common_exit (&client->dev); +return 0 ; }static struct i2c_driver mc13xxx_i2c_driver = {
drivers/mfd/mc13xxx-spi.c +2 -1
@@ -168,7 +168,8 @@ static int mc13xxx_spi_probe(struct spi_device *spi)static int mc13xxx_spi_remove (struct spi_device *spi) { -return mc13xxx_common_exit (&spi->dev); +mc13xxx_common_exit (&spi->dev); +return 0 ; }static struct spi_driver mc13xxx_spi_driver = {
drivers/mfd/mc13xxx.h +1 -1
@@ -44,6 +44,6 @@ struct mc13xxx { };int mc13xxx_common_init (struct device *dev); -int mc13xxx_common_exit (struct device *dev); +void mc13xxx_common_exit (struct device *dev);#endif /* __DRIVERS_MFD_MC13XXX_H */
Signature · 1 line
2.30.2
Lee Jones
AppliedRe: [PATCH v2 08/20] mfd: mc13xxx: Make mc13xxx_common_exit() return void
Quoted 6 lines · Uwe Kleine-König
Up to now
mc13xxx_common_exit()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.
Quoted 7 lines
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mfd/mc13xxx-core.c | 4 +--- drivers/mfd/mc13xxx-i2c.c | 3 ++- drivers/mfd/mc13xxx-spi.c | 3 ++- drivers/mfd/mc13xxx.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 9/20 mfd: stmpe: Make stmpe_remove() return void
In reply to Uwe Kleine-KönigUp to now stmpe_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.
--- drivers/mfd/stmpe-i2c.c | 4 +++- drivers/mfd/stmpe-spi.c | 4 +++- drivers/mfd/stmpe.c | 4 +--- drivers/mfd/stmpe.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/stmpe-i2c.c +3 -1
@@ -95,7 +95,9 @@ static int stmpe_i2c_remove(struct i2c_client *i2c) {struct stmpe *stmpe =dev_get_drvdata (&i2c->dev); -return stmpe_remove (stmpe); +stmpe_remove (stmpe); + +return 0 ; }static const struct i2c_device_id stmpe_i2c_id[] = {
drivers/mfd/stmpe-spi.c +3 -1
@@ -106,7 +106,9 @@ static int stmpe_spi_remove(struct spi_device *spi) {struct stmpe *stmpe =spi_get_drvdata (spi); -return stmpe_remove (stmpe); +stmpe_remove (stmpe); + +return 0 ; }static const struct of_device_id stmpe_spi_of_match[] = {
drivers/mfd/stmpe.c +1 -3
@@ -1496,7 +1496,7 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)return ret; } -int stmpe_remove (struct stmpe *stmpe) +void stmpe_remove (struct stmpe *stmpe) {if (!IS_ERR (stmpe->vio))regulator_disable (stmpe->vio);
@@ -1506,8 +1506,6 @@ int stmpe_remove(struct stmpe *stmpe)__stmpe_disable (stmpe,STMPE_BLOCK_ADC );mfd_remove_devices (stmpe->dev); - -return 0 ; }#ifdef CONFIG_PM
drivers/mfd/stmpe.h +1 -1
@@ -98,7 +98,7 @@ struct stmpe_client_info { };int stmpe_probe (struct stmpe_client_info *ci,enum stmpe_partnum partnum); -int stmpe_remove (struct stmpe *stmpe); +void stmpe_remove (struct stmpe *stmpe);#define STMPE_ICR_LSB_HIGH (1 << 2)#define STMPE_ICR_LSB_EDGE (1 << 1)
Signature · 1 line
2.30.2
Lee Jones
AppliedRe: [PATCH v2 09/20] mfd: stmpe: Make stmpe_remove() return void
Quoted 6 lines · Uwe Kleine-König
Up to now
stmpe_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.
Quoted 7 lines
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mfd/stmpe-i2c.c | 4 +++- drivers/mfd/stmpe-spi.c | 4 +++- drivers/mfd/stmpe.c | 4 +--- drivers/mfd/stmpe.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 10/20 mfd: tps65912: Make tps65912_device_exit() return void
In reply to Uwe Kleine-KönigUp to now tps65912_device_exit() 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.
--- drivers/mfd/tps65912-core.c | 4 +--- drivers/mfd/tps65912-i2c.c | 4 +++- drivers/mfd/tps65912-spi.c | 4 +++- include/linux/mfd/tps65912.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
drivers/mfd/tps65912-core.c +1 -3
@@ -115,11 +115,9 @@ int tps65912_device_init(struct tps65912 *tps) }EXPORT_SYMBOL_GPL (tps65912_device_init); -int tps65912_device_exit (struct tps65912 *tps) +void tps65912_device_exit (struct tps65912 *tps) {regmap_del_irq_chip (tps->irq, tps->irq_data); - -return 0 ; }EXPORT_SYMBOL_GPL (tps65912_device_exit);
drivers/mfd/tps65912-i2c.c +3 -1
@@ -55,7 +55,9 @@ static int tps65912_i2c_remove(struct i2c_client *client) {struct tps65912 *tps =i2c_get_clientdata (client); -return tps65912_device_exit (tps); +tps65912_device_exit (tps); + +return 0 ; }static const struct i2c_device_id tps65912_i2c_id_table[] = {
drivers/mfd/tps65912-spi.c +3 -1
@@ -54,7 +54,9 @@ static int tps65912_spi_remove(struct spi_device *spi) {struct tps65912 *tps =spi_get_drvdata (spi); -return tps65912_device_exit (tps); +tps65912_device_exit (tps); + +return 0 ; }static const struct spi_device_id tps65912_spi_id_table[] = {
include/linux/mfd/tps65912.h +1 -1
@@ -322,6 +322,6 @@ struct tps65912 {extern const struct regmap_config tps65912_regmap_config;int tps65912_device_init (struct tps65912 *tps); -int tps65912_device_exit (struct tps65912 *tps); +void tps65912_device_exit (struct tps65912 *tps);#endif /* __LINUX_MFD_TPS65912_H */
Signature · 1 line
2.30.2
Lee Jones
AppliedRe: [PATCH v2 10/20] mfd: tps65912: Make tps65912_device_exit() return void
Quoted 6 lines · Uwe Kleine-König
Up to now
tps65912_device_exit()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.
Quoted 7 lines
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mfd/tps65912-core.c | 4 +--- drivers/mfd/tps65912-i2c.c | 4 +++- drivers/mfd/tps65912-spi.c | 4 +++- include/linux/mfd/tps65912.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-)
Applied, thanks.
Signature · 4 lines
Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v2 11/20 misc: ad525x_dpot: Make ad_dpot_remove() return void
In reply to Uwe Kleine-KönigUp to now ad_dpot_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.
--- drivers/misc/ad525x_dpot-i2c.c | 3 ++- drivers/misc/ad525x_dpot-spi.c | 3 ++- drivers/misc/ad525x_dpot.c | 4 +--- drivers/misc/ad525x_dpot.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/misc/ad525x_dpot-i2c.c +2 -1
@@ -69,7 +69,8 @@ static int ad_dpot_i2c_probe(struct i2c_client *client,static int ad_dpot_i2c_remove (struct i2c_client *client) { -return ad_dpot_remove (&client->dev); +ad_dpot_remove (&client->dev); +return 0 ; }static const struct i2c_device_id ad_dpot_id[] = {
drivers/misc/ad525x_dpot-spi.c +2 -1
@@ -92,7 +92,8 @@ static int ad_dpot_spi_probe(struct spi_device *spi)static int ad_dpot_spi_remove (struct spi_device *spi) { -return ad_dpot_remove (&spi->dev); +ad_dpot_remove (&spi->dev); +return 0 ; }static const struct spi_device_id ad_dpot_spi_id[] = {
drivers/misc/ad525x_dpot.c +1 -3
@@ -743,7 +743,7 @@ int ad_dpot_probe(struct device *dev, }EXPORT_SYMBOL (ad_dpot_probe); -int ad_dpot_remove (struct device *dev) +void ad_dpot_remove (struct device *dev) {struct dpot_data *data =dev_get_drvdata (dev);int i;
@@ -753,8 +753,6 @@ int ad_dpot_remove(struct device *dev)ad_dpot_remove_files (dev, data->feat, i);kfree (data); - -return 0 ; }EXPORT_SYMBOL (ad_dpot_remove);
drivers/misc/ad525x_dpot.h +1 -1
@@ -209,6 +209,6 @@ struct ad_dpot_bus_data {int ad_dpot_probe (struct device *dev,struct ad_dpot_bus_data *bdata,unsigned long devid,const char *name); -int ad_dpot_remove (struct device *dev); +void ad_dpot_remove (struct device *dev);#endif
Signature · 1 line
2.30.2
RE: [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() return void
Quoted 13 lines
-----Original Message-----
From: Uwe Kleine-König <[email protected]>
Sent: Dienstag, 12. Oktober 2021 17:40
To: Arnd Bergmann <[email protected]>; Greg Kroah-Hartman <[email protected]>; Hennerich, Michael <[email protected]>
Cc: Mark Brown <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: [PATCH v2 11/20] misc:ad525x_dpot: Makead_dpot_remove()return void
Quoted 7 lines
Up to now
ad_dpot_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]>
Quoted 68 lines
--- drivers/misc/ad525x_dpot-i2c.c | 3 ++- drivers/misc/ad525x_dpot-spi.c | 3 ++- drivers/misc/ad525x_dpot.c | 4 +--- drivers/misc/ad525x_dpot.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)drivers/misc/ad525x_dpot-i2c.c +2
-1@@ -69,7 +69,8 @@ static int ad_dpot_i2c_probe(struct i2c_client *client,static int ad_dpot_i2c_remove (struct i2c_client *client) { -return ad_dpot_remove (&client->dev); +ad_dpot_remove (&client->dev); +return 0 ; } static const struct i2c_device_id ad_dpot_id[] = { diff --git
a/drivers/misc/ad525x_dpot-spi.cb/drivers/misc/ad525x_dpot-spi.cindexaea931dd272e..a9e75d80ad36100644drivers/misc/ad525x_dpot-spi.c +2
-1@@ -92,7 +92,8 @@ static int ad_dpot_spi_probe(struct spi_device *spi)static int ad_dpot_spi_remove (struct spi_device *spi) { -return ad_dpot_remove (&spi->dev); +ad_dpot_remove (&spi->dev); +return 0 ; } static const struct spi_device_id ad_dpot_spi_id[] = { diff --git
a/drivers/misc/ad525x_dpot.cb/drivers/misc/ad525x_dpot.cindex5d8f3f6a95f2..756ef6912b5a100644drivers/misc/ad525x_dpot.c +1
-3@@ -743,7 +743,7 @@ int ad_dpot_probe(struct device *dev, }EXPORT_SYMBOL (ad_dpot_probe); -int ad_dpot_remove (struct device *dev) +void ad_dpot_remove (struct device *dev) {struct dpot_data *data =dev_get_drvdata (dev);int i;@@ -753,8 +753,6 @@ int ad_dpot_remove(struct device *dev)ad_dpot_remove_files (dev, data->feat, i);kfree (data); - -return 0 ; }EXPORT_SYMBOL (ad_dpot_remove);drivers/misc/ad525x_dpot.h index renamed from drivers/misc/ad525x_dpot.h +0
-0
ee8dc9f5a45a..72a9d6801937100644drivers/misc/ad525x_dpot.h +1
-1@@ -209,6 +209,6 @@ struct ad_dpot_bus_data {int ad_dpot_probe (struct device *dev,struct ad_dpot_bus_data *bdata, unsigned long devid, const char *name); -int ad_dpot_remove(struct device *dev); +void ad_dpot_remove (struct device *dev);#endif --2.30.2
PATCH v2 12/20 misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
In reply to Uwe Kleine-KönigUp to now lis3lv02d_remove_fs() 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.
--- drivers/misc/lis3lv02d/lis3lv02d.c | 3 +-- drivers/misc/lis3lv02d/lis3lv02d.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d_spi.c | 4 +++- drivers/platform/x86/hp_accel.c | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-)
drivers/misc/lis3lv02d/lis3lv02d.c +1 -2
@@ -878,7 +878,7 @@ static int lis3lv02d_add_fs(struct lis3lv02d *lis3)return sysfs_create_group (&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group); } -int lis3lv02d_remove_fs (struct lis3lv02d *lis3) +void lis3lv02d_remove_fs (struct lis3lv02d *lis3) {sysfs_remove_group (&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);platform_device_unregister (lis3->pdev);
@@ -894,7 +894,6 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3)pm_runtime_set_suspended (lis3->pm_dev); }kfree (lis3->reg_cache); -return 0 ; }EXPORT_SYMBOL_GPL (lis3lv02d_remove_fs);
drivers/misc/lis3lv02d/lis3lv02d.h +1 -1
@@ -312,7 +312,7 @@ int lis3lv02d_joystick_enable(struct lis3lv02d *lis3);void lis3lv02d_joystick_disable (struct lis3lv02d *lis3);void lis3lv02d_poweroff (struct lis3lv02d *lis3);int lis3lv02d_poweron (struct lis3lv02d *lis3); -int lis3lv02d_remove_fs (struct lis3lv02d *lis3); +void lis3lv02d_remove_fs (struct lis3lv02d *lis3);int lis3lv02d_init_dt (struct lis3lv02d *lis3);extern struct lis3lv02d lis3_dev;
drivers/misc/lis3lv02d/lis3lv02d_spi.c +3 -1
@@ -102,7 +102,9 @@ static int lis302dl_spi_remove(struct spi_device *spi)lis3lv02d_joystick_disable (lis3);lis3lv02d_poweroff (lis3); -return lis3lv02d_remove_fs (&lis3_dev); +lis3lv02d_remove_fs (&lis3_dev); + +return 0 ; }#ifdef CONFIG_PM_SLEEP
drivers/platform/x86/hp_accel.c +2 -1
@@ -349,7 +349,8 @@ static int lis3lv02d_remove(struct platform_device *device)led_classdev_unregister (&hpled_led.led_classdev);flush_work (&hpled_led.work); -return lis3lv02d_remove_fs (&lis3_dev); +lis3lv02d_remove_fs (&lis3_dev); +return 0 ; }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.30.2
Re: [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
Hi,
Quoted 7 lines · Uwe Kleine-König
Up to now
lis3lv02d_remove_fs()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]>
Thanks, patch looks good to me:
Also please consider this as my ack for merging the drivers/platform/x86/ part of this through whatever tree is convenient.
Regards,
Hans
Quoted 71 lines
--- drivers/misc/lis3lv02d/lis3lv02d.c | 3 +-- drivers/misc/lis3lv02d/lis3lv02d.h | 2 +- drivers/misc/lis3lv02d/lis3lv02d_spi.c | 4 +++- drivers/platform/x86/hp_accel.c | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-)drivers/misc/lis3lv02d/lis3lv02d.c +1
-2@@ -878,7 +878,7 @@ static int lis3lv02d_add_fs(struct lis3lv02d *lis3)return sysfs_create_group (&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group); } -int lis3lv02d_remove_fs (struct lis3lv02d *lis3) +void lis3lv02d_remove_fs (struct lis3lv02d *lis3) {sysfs_remove_group (&lis3->pdev->dev.kobj, &lis3lv02d_attribute_group);platform_device_unregister (lis3->pdev);@@ -894,7 +894,6 @@ int lis3lv02d_remove_fs(struct lis3lv02d *lis3)pm_runtime_set_suspended (lis3->pm_dev); }kfree (lis3->reg_cache); -return 0 ; }EXPORT_SYMBOL_GPL (lis3lv02d_remove_fs);drivers/misc/lis3lv02d/lis3lv02d.h +1
-1@@ -312,7 +312,7 @@ int lis3lv02d_joystick_enable(struct lis3lv02d *lis3);void lis3lv02d_joystick_disable (struct lis3lv02d *lis3);void lis3lv02d_poweroff (struct lis3lv02d *lis3);int lis3lv02d_poweron (struct lis3lv02d *lis3); -int lis3lv02d_remove_fs (struct lis3lv02d *lis3); +void lis3lv02d_remove_fs (struct lis3lv02d *lis3);int lis3lv02d_init_dt (struct lis3lv02d *lis3);extern struct lis3lv02d lis3_dev;drivers/misc/lis3lv02d/lis3lv02d_spi.c +3
-1@@ -102,7 +102,9 @@ static int lis302dl_spi_remove(struct spi_device *spi)lis3lv02d_joystick_disable (lis3);lis3lv02d_poweroff (lis3); -return lis3lv02d_remove_fs (&lis3_dev); +lis3lv02d_remove_fs (&lis3_dev); + +return 0 ; }#ifdef CONFIG_PM_SLEEP drivers/platform/x86/hp_accel.c +2
-1@@ -349,7 +349,8 @@ static int lis3lv02d_remove(struct platform_device *device)led_classdev_unregister (&hpled_led.led_classdev);flush_work (&hpled_led.work); -return lis3lv02d_remove_fs (&lis3_dev); +lis3lv02d_remove_fs (&lis3_dev); +return 0 ; }#ifdef CONFIG_PM_SLEEP
Greg Kroah-Hartman
maintainerRe: [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
Quoted 11 lines · Hans de Goede
Hi,
Quoted 7 lines · Uwe Kleine-König
Up to now
lis3lv02d_remove_fs()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]>
Quoted 7 lines
Thanks, patch looks good to me:
Reviewed-by Hans de Goede <[email protected]>Also please consider this as my ack for merging the
drivers/platform/x86/part of this through whatever tree is convenient.
Thanks, I'll take it!
greg k-h
PATCH v2 13/20 mtd: dataflash: Warn about failure to unregister mtd device
In reply to Uwe Kleine-KönigWhen an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
--- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/mtd/devices/mtd_dataflash.c +4 -1
@@ -919,7 +919,10 @@ static int dataflash_remove(struct spi_device *spi) status =mtd_device_unregister (&flash->mtd);if (status ==0 )kfree (flash); -return status; +else +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (status)); +return 0 ; }static struct spi_driver dataflash_driver = {
Signature · 1 line
2.30.2
Miquel Raynal
maintainerRe: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
Hi Uwe,
[email protected] wrote on Tue, 12 Oct 2021 17:39:38 +0200:
Quoted 1 line
When an spi driver's remove function returns a non-zero error code
Should we s/an spi/a SPI/?
Quoted 13 lines
nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/mtd/devices/mtd_dataflash.c +0
-0
drivers/mtd/devices/mtd_dataflash.c static int dataflash_remove(struct spi_device *spi) · line 925
Quoted 8 lines
drivers/mtd/devices/mtd_dataflash.c +4
-1@@ -919,7 +919,10 @@ static int dataflash_remove(struct spi_device *spi) status =mtd_device_unregister (&flash->mtd);if (status ==0 )kfree (flash); -return status; +else +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (status)); +return 0 ;
As part of a recent NAND cleanup series we ended up adding WARN_ON() [1] to make it very clear that if this happens, it's not expected at all (it was Boris' advice).
I don't think there is only one good solution but perhaps its best to keep it sync'ed with the other drivers in MTD?
Thanks,
Miquèl
[1]d6e4fd522461 mtd: rawnand: nandsim: Stop using nand_release() 9fdd78f7bcda mtd: rawnand: xway: Stop using nand_release() d9f2a1af817d mtd: rawnand: vf610: Stop using nand_release() f6fc75978d88 mtd: rawnand: txx9ndfmc: Stop using nand_release() f3e169f44bdb mtd: rawnand: tmio: Stop using nand_release() ab135c51bb81 mtd: rawnand: tango: Stop using nand_release() 068d86ecd9d9 mtd: rawnand: sunxi: Stop using nand_release() 24acc3fa8b36 mtd: rawnand: stm32_fmc2: Stop using nand_release() c121cb980c09 mtd: rawnand: socrates: Stop using nand_release() 35a37f9198e5 mtd: rawnand: sharpsl: Stop using nand_release() 50abacbb621f mtd: rawnand: sh_flctl: Stop using nand_release() 9748110bd22c mtd: rawnand: s3c2410: Stop using nand_release() 10b87750ae17 mtd: rawnand: r852: Stop using nand_release() 0a2bc9919cf7 mtd: rawnand: qcom: Stop using nand_release() d1aae005a00e mtd: rawnand: plat_nand: Stop using nand_release() 23cf34615010 mtd: rawnand: pasemi: Stop using nand_release() 2d9cf6f129f8 mtd: rawnand: oxnas: Stop using nand_release() f342df67b19a mtd: rawnand: orion: Stop using nand_release() b4533679c958 mtd: rawnand: omap2: Stop using nand_release() a9384f95fe77 mtd: rawnand: ndfc: Stop using nand_release() 8fd507bb4210 mtd: rawnand: mxic: Stop using nand_release() c6dc082793d2 mtd: rawnand: mxc: Stop using nand_release() 1fec333aadc2 mtd: rawnand: mtk: Stop using nand_release() 1a36a7f78898 mtd: rawnand: mpc5121: Stop using nand_release() 5ecbba617446 mtd: rawnand: marvell: Stop using nand_release() 21b758277724 mtd: rawnand: lpc32xx_slc: Stop using nand_release() 5f3bce3a5275 mtd: rawnand: lpc32xx_mlc: Stop using nand_release() 28dcc4e8a831 mtd: rawnand: ingenic: Stop using nand_release() 71a4917b4d4b mtd: rawnand: hisi504: Stop using nand_release() 194f6c48cdd8 mtd: rawnand: gpmi: Stop using nand_release() dbe0241570ed mtd: rawnand: gpio: Stop using nand_release() 9cc02f4c0a87 mtd: rawnand: fsmc: Stop using nand_release() f6c4e661491a mtd: rawnand: fsl_upm: Stop using nand_release() e9f2f5a80754 mtd: rawnand: fsl_ifc: Stop using nand_release() 128bbbf0ac4d mtd: rawnand: fsl_elbc: Stop using nand_release() 63a1460768a1 mtd: rawnand: diskonchip: Stop using nand_release() 009e2e1d8318 mtd: rawnand: denali: Stop using nand_release() a9575c48e520 mtd: rawnand: davinci: Stop using nand_release() 970024f031ae mtd: rawnand: cs553x: Stop using nand_release() 544bac8999a6 mtd: rawnand: cafe: Stop using nand_release() 8b88f4e0a88b mtd: rawnand: cadence: Stop using nand_release() 937d039dfdcf mtd: rawnand: brcmnand: Stop using nand_release() 936904305928 mtd: rawnand: bcm47xx: Stop using nand_release() 4a3d21bc25c1 mtd: rawnand: au1550nd: Stop using nand_release() 08f25cd767e1 mtd: rawnand: ams-delta: Stop using nand_release()
Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
Quoted 7 lines · Miquel Raynal
Hi Uwe,
[email protected] wrote on Tue, 12 Oct 2021 17:39:38 +0200:
Quoted 1 line
When an spi driver's remove function returns a non-zero error code
Should we s/an spi/a SPI/?
My (German) knowledge about the English Grammar claims that independent of how you spell SPI, it must be "an" because when I say it, it's [ɛspi:aɪ] (unless you call it [spaɪ]?)
In my eyes "spi" is right, because SPI is the protocol and "spi" is the kernel framework. But I don't feel strong here and you're already the second who suggests something similar.
Quoted 26 lines
Quoted 13 lines
nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/mtd/devices/mtd_dataflash.c +0
-0drivers/mtd/devices/mtd_dataflash.c static int dataflash_remove(struct spi_device *spi) · line 925
Quoted 8 lines
drivers/mtd/devices/mtd_dataflash.c +4
-1@@ -919,7 +919,10 @@ static int dataflash_remove(struct spi_device *spi) status =mtd_device_unregister (&flash->mtd);if (status ==0 )kfree (flash); -return status; +else +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (status)); +return 0 ;As part of a recent NAND cleanup series we ended up adding
WARN_ON()[1] to make it very clear that if this happens, it's not expected at all (it was Boris' advice).
Quoted 2 lines
I don't think there is only one good solution but perhaps its best to keep it sync'ed with the other drivers in MTD?
Well, if WARN_ON or dev_warn is the right thing is subjective. Your subjective counts more as you're an MTD maintainer. Can rework accordingly for v3.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | https://www.pengutronix.de/ |
Miquel Raynal
maintainerRe: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
Hi Uwe,
[email protected] wrote on Wed, 13 Oct 2021 16:08:35 +0200:
Quoted 5 lines · Miquel Raynal
Quoted 4 lines
Hi Uwe,
[email protected] wrote on Tue, 12 Oct 2021 17:39:38 +0200:
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
When an spi driver's remove function returns a non-zero error code
Should we s/an spi/a SPI/?
My (German) knowledge about the English Grammar claims that independent of how you spell SPI, it must be "an" because when I say it, it's [ɛspi:aɪ] (unless you call it [spaɪ]?)
I (personally) pronounce it [spaɪ] with my French background and it looks wrong to my eyes to use "an" before SPI because of that, but this is biased and possibly wrong as well so please keep it your way, it's fine.
Quoted 3 lines
In my eyes "spi" is right, because SPI is the protocol and "spi" is the kernel framework. But I don't feel strong here and you're already the second who suggests something similar.
I get it. Indeed I always use uppercase letters when I use acronyms (such as SPI or MTD) and it's the first time I hear that the lowercase letter refers to the framework more than the protocol, but TBH the explanation kind of seduces me :)
Quoted 27 lines
Quoted 27 lines
Quoted 20 lines
nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/mtd/devices/mtd_dataflash.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/mtd/devices/mtd_dataflash.cindex9802e265fca8..2691b6b79df8100644 ---a/drivers/mtd/devices/mtd_dataflash.c+++b/drivers/mtd/devices/mtd_dataflash.c@@ -919,7 +919,10 @@ static intdataflash_remove(struct spi_device *spi)status =mtd_device_unregister(&flash->mtd); if (status == 0)drivers/mtd/devices/mtd_dataflash.c +2
-1kfree (flash); -return status; + else + dev_warn(&spi->dev, "Failed to unregister mtddevice (%pe)\n",
drivers/mtd/devices/mtd_dataflash.c static int dataflash_remove(struct spi_device *spi) · line 925
Quoted 2 lines
drivers/mtd/devices/mtd_dataflash.c +2
-0+ ERR_PTR(status)); +return 0 ;As part of a recent NAND cleanup series we ended up adding
WARN_ON()[1] to make it very clear that if this happens, it's not expected at all (it was Boris' advice).
Quoted 6 lines
Quoted 2 lines
I don't think there is only one good solution but perhaps its best to keep it sync'ed with the other drivers in MTD?
Well, if
WARN_ONordev_warnis the right thing is subjective. Your subjective counts more as you're an MTD maintainer. Can rework accordingly for v3.
Then let's all use WARN_ON() for now.
Thanks,
Miquèl
Mark Brown
maintainerRe: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
Quoted 10 lines · Miquel Raynal
Quoted 5 lines · Miquel Raynal
My (German) knowledge about the English Grammar claims that independent of how you spell SPI, it must be "an" because when I say it, it's [ɛspi:aɪ] (unless you call it [spaɪ]?)
I (personally) pronounce it [spaɪ] with my French background and it looks wrong to my eyes to use "an" before SPI because of that, but this is biased and possibly wrong as well so please keep it your way, it's fine.
I'd say a here too but really don't care too much, I hadn't noticed.
PATCH v2 14/20 mtd: mchp23k256: Warn about failure to unregister mtd device
In reply to Uwe Kleine-KönigWhen an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
--- drivers/mtd/devices/mchp23k256.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mtd/devices/mchp23k256.c +8 -1
@@ -212,8 +212,15 @@ static int mchp23k256_probe(struct spi_device *spi)static int mchp23k256_remove (struct spi_device *spi) {struct mchp23k256_flash *flash =spi_get_drvdata (spi); +int ret; -return mtd_device_unregister (&flash->mtd); + ret =mtd_device_unregister (&flash->mtd); +if (ret) +/* There is nothing we can do about this ... */ +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (ret)); + +return 0 ; }static const struct of_device_id mchp23k256_of_table[] = {
Signature · 1 line
2.30.2
PATCH v2 15/20 mtd: mchp48l640: Warn about failure to unregister mtd device
In reply to Uwe Kleine-KönigWhen an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
--- drivers/mtd/devices/mchp48l640.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mtd/devices/mchp48l640.c +7 -1
@@ -344,8 +344,14 @@ static int mchp48l640_probe(struct spi_device *spi)static int mchp48l640_remove (struct spi_device *spi) {struct mchp48l640_flash *flash =spi_get_drvdata (spi); +int ret; + + ret =mtd_device_unregister (&flash->mtd); +if (ret) +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (ret)); -return mtd_device_unregister (&flash->mtd); +return 0 ; }static const struct of_device_id mchp48l640_of_table[] = {
Signature · 1 line
2.30.2
PATCH v2 16/20 mtd: sst25l: Warn about failure to unregister mtd device
In reply to Uwe Kleine-KönigWhen an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead.
--- drivers/mtd/devices/sst25l.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mtd/devices/sst25l.c +7 -1
@@ -401,8 +401,14 @@ static int sst25l_probe(struct spi_device *spi)static int sst25l_remove (struct spi_device *spi) {struct sst25l_flash *flash =spi_get_drvdata (spi); +int ret; + + ret =mtd_device_unregister (&flash->mtd); +if (ret) +dev_warn (&spi->dev,"Failed to unregister mtd device (%pe)\n" , +ERR_PTR (ret)); -return mtd_device_unregister (&flash->mtd); +return 0 ; }static struct spi_driver sst25l_driver = {
Signature · 1 line
2.30.2
PATCH v2 17/20 serial: max310x: Make max310x_remove() return void
In reply to Uwe Kleine-KönigUp to now max310x_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 spi remove callbacks is ignored anyway.
--- drivers/tty/serial/max310x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/tty/serial/max310x.c +3 -4
@@ -1426,7 +1426,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devtyreturn ret; } -static int max310x_remove (struct device *dev) +static void max310x_remove (struct device *dev) {struct max310x_port *s =dev_get_drvdata (dev);int i;
@@ -1441,8 +1441,6 @@ static int max310x_remove(struct device *dev) }clk_disable_unprepare (s->clk); - -return 0 ; }static const struct of_device_id __maybe_unused max310x_dt_ids[] = {
@@ -1491,7 +1489,8 @@ static int max310x_spi_probe(struct spi_device *spi)static int max310x_spi_remove (struct spi_device *spi) { -return max310x_remove (&spi->dev); +max310x_remove (&spi->dev); +return 0 ; }static const struct spi_device_id max310x_id_table[] = {
Signature · 1 line
2.30.2
PATCH v2 18/20 serial: sc16is7xx: Make sc16is7xx_remove() return void
In reply to Uwe Kleine-KönigUp to now sc16is7xx_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 spi remove callbacks is ignored anyway.
--- drivers/tty/serial/sc16is7xx.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/tty/serial/sc16is7xx.c +7 -5
@@ -1365,7 +1365,7 @@ static int sc16is7xx_probe(struct device *dev,return ret; } -static int sc16is7xx_remove (struct device *dev) +static void sc16is7xx_remove (struct device *dev) {struct sc16is7xx_port *s =dev_get_drvdata (dev);int i;
@@ -1385,8 +1385,6 @@ static int sc16is7xx_remove(struct device *dev)kthread_stop (s->kworker_task);clk_disable_unprepare (s->clk); - -return 0 ; }static const struct of_device_id __maybe_unused sc16is7xx_dt_ids[] = {
@@ -1444,7 +1442,9 @@ static int sc16is7xx_spi_probe(struct spi_device *spi)static int sc16is7xx_spi_remove (struct spi_device *spi) { -return sc16is7xx_remove (&spi->dev); +sc16is7xx_remove (&spi->dev); + +return 0 ; }static const struct spi_device_id sc16is7xx_spi_id_table[] = {
@@ -1497,7 +1497,9 @@ static int sc16is7xx_i2c_probe(struct i2c_client *i2c,static int sc16is7xx_i2c_remove (struct i2c_client *client) { -return sc16is7xx_remove (&client->dev); +sc16is7xx_remove (&client->dev); + +return 0 ; }static const struct i2c_device_id sc16is7xx_i2c_id_table[] = {
Signature · 1 line
2.30.2
PATCH v2 19/20 staging: fbtft: Make fbtft_remove_common() return void
In reply to Uwe Kleine-Königfbtft_remove_common() is only called with a non-NULL fb_info. (All callers are in remove callbacks and the matching probe callbacks set driver data accordingly.) So fbtft_remove_common() always returns zero. 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 platform and spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea.
--- drivers/staging/fbtft/fbtft-core.c | 8 +------- drivers/staging/fbtft/fbtft.h | 8 +++++--- 2 files changed, 6 insertions(+), 10 deletions(-)
drivers/staging/fbtft/fbtft-core.c +1 -7
@@ -1318,23 +1318,17 @@ EXPORT_SYMBOL(fbtft_probe_common);* @info: Framebuffer * * Unregisters and releases the framebuffer -* -* Return: 0 if successful, negative if error */ -int fbtft_remove_common (struct device *dev,struct fb_info *info) +void fbtft_remove_common (struct device *dev,struct fb_info *info) {struct fbtft_par *par; -if (!info) -return -EINVAL ; par = info->par;if (par)fbtft_par_dbg (DEBUG_DRIVER_INIT_FUNCTIONS , par,"%s()\n" , __func__);fbtft_unregister_framebuffer (info);fbtft_framebuffer_release (info); - -return 0 ; }EXPORT_SYMBOL (fbtft_remove_common);
drivers/staging/fbtft/fbtft.h +5 -3
@@ -252,7 +252,7 @@ void fbtft_unregister_backlight(struct fbtft_par *par);int fbtft_init_display (struct fbtft_par *par);int fbtft_probe_common (struct fbtft_display *display,struct spi_device *sdev,struct platform_device *pdev); -int fbtft_remove_common (struct device *dev,struct fb_info *info); +void fbtft_remove_common (struct device *dev,struct fb_info *info);/* fbtft-io.c */ int fbtft_write_spi (struct fbtft_par *par,void *buf,size_t len);
@@ -283,7 +283,8 @@ static int fbtft_driver_remove_spi(struct spi_device *spi) \ { \struct fb_info *info =spi_get_drvdata (spi); \ \ -return fbtft_remove_common (&spi->dev, info); \ +fbtft_remove_common (&spi->dev, info); \ +return 0 ; \ } \ \static int fbtft_driver_probe_pdev (struct platform_device *pdev) \
@@ -295,7 +296,8 @@ static int fbtft_driver_remove_pdev(struct platform_device *pdev) \ { \struct fb_info *info =platform_get_drvdata (pdev); \ \ -return fbtft_remove_common (&pdev->dev, info); \ +fbtft_remove_common (&pdev->dev, info); \ +return 0 ; \ } \ \static const struct of_device_id dt_ids[] = { \
Signature · 1 line
2.30.2
Re: [PATCH v2 19/20] staging: fbtft: Make fbtft_remove_common() return void
Quoted 9 lines · Uwe Kleine-König
fbtft_remove_common()is only called with a non-NULLfb_info. (All callers are in remove callbacks and the matching probe callbacks set driver data accordingly.) Sofbtft_remove_common()always returns zero. 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 platform and spi remove callbacks is ignored anyway and not freeing resources in .remove() is a bad idea.
Quoted 71 lines
Signed-off-by Uwe Kleine-König <[email protected]>--- drivers/staging/fbtft/fbtft-core.c | 8 +------- drivers/staging/fbtft/fbtft.h | 8 +++++--- 2 files changed, 6 insertions(+), 10 deletions(-)drivers/staging/fbtft/fbtft-core.c +1
-7@@ -1318,23 +1318,17 @@ EXPORT_SYMBOL(fbtft_probe_common);* @info: Framebuffer * * Unregisters and releases the framebuffer -* -* Return: 0 if successful, negative if error */ -int fbtft_remove_common (struct device *dev,struct fb_info *info) +void fbtft_remove_common (struct device *dev,struct fb_info *info) {struct fbtft_par *par; -if (!info) -return -EINVAL ; par = info->par;if (par)fbtft_par_dbg (DEBUG_DRIVER_INIT_FUNCTIONS , par,"%s()\n" , __func__);fbtft_unregister_framebuffer (info);fbtft_framebuffer_release (info); - -return 0 ; }EXPORT_SYMBOL (fbtft_remove_common);drivers/staging/fbtft/fbtft.h +5
-4@@ -252,7 +252,7 @@ void fbtft_unregister_backlight(struct fbtft_par *par);int fbtft_init_display (struct fbtft_par *par);int fbtft_probe_common (struct fbtft_display *display,struct spi_device *sdev,struct platform_device *pdev); -int fbtft_remove_common (struct device *dev,struct fb_info *info); +void fbtft_remove_common (struct device *dev,struct fb_info *info);/* fbtft-io.c */ int fbtft_write_spi (struct fbtft_par *par,void *buf,size_t len);@@ -283,7 +283,8 @@ static int fbtft_driver_remove_spi(struct spi_device *spi) \ { \struct fb_info *info =spi_get_drvdata (spi); \ \ -return fbtft_remove_common (&spi->dev, info); \ +fbtft_remove_common (&spi->dev, info); \ +return 0 ; \ } \ \static int fbtft_driver_probe_pdev (struct platform_device *pdev) \@@ -295,7 +296,8 @@ static int fbtft_driver_remove_pdev(struct platform_device *pdev) \ { \struct fb_info *info =platform_get_drvdata (pdev); \ \ -return fbtft_remove_common (&pdev->dev, info); \ +fbtft_remove_common (&pdev->dev, info); \ +return 0 ; \ } \ \static const struct of_device_id dt_ids[] = { \ --2.30.2
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v2 20/20 tpm: st33zp24: Make st33zp24_remove() return void
In reply to Uwe Kleine-KönigUp to now st33zp24_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.
--- drivers/char/tpm/st33zp24/i2c.c | 5 +---- drivers/char/tpm/st33zp24/spi.c | 5 +---- drivers/char/tpm/st33zp24/st33zp24.c | 3 +-- drivers/char/tpm/st33zp24/st33zp24.h | 2 +- 4 files changed, 4 insertions(+), 11 deletions(-)
drivers/char/tpm/st33zp24/i2c.c +1 -4
@@ -267,11 +267,8 @@ static int st33zp24_i2c_probe(struct i2c_client *client,static int st33zp24_i2c_remove (struct i2c_client *client) {struct tpm_chip *chip =i2c_get_clientdata (client); -int ret; - ret =st33zp24_remove (chip); -if (ret) -return ret; +st33zp24_remove (chip);return 0 ; }
drivers/char/tpm/st33zp24/spi.c +1 -4
@@ -384,11 +384,8 @@ static int st33zp24_spi_probe(struct spi_device *dev)static int st33zp24_spi_remove (struct spi_device *dev) {struct tpm_chip *chip =spi_get_drvdata (dev); -int ret; - ret =st33zp24_remove (chip); -if (ret) -return ret; +st33zp24_remove (chip);return 0 ; }
drivers/char/tpm/st33zp24/st33zp24.c +1 -2
@@ -588,10 +588,9 @@ EXPORT_SYMBOL(st33zp24_probe);* @param: tpm_data, the tpm phy. * @return: 0 in case of success. */ -int st33zp24_remove (struct tpm_chip *chip) +void st33zp24_remove (struct tpm_chip *chip) {tpm_chip_unregister (chip); -return 0 ; }EXPORT_SYMBOL (st33zp24_remove);
drivers/char/tpm/st33zp24/st33zp24.h +1 -1
@@ -34,5 +34,5 @@ int st33zp24_pm_resume(struct device *dev);int st33zp24_probe (void *phy_id,const struct st33zp24_phy_ops *ops,struct device *dev,int irq,int io_lpcpd); -int st33zp24_remove (struct tpm_chip *chip); +void st33zp24_remove (struct tpm_chip *chip);#endif /* __LOCAL_ST33ZP24_H__ */
Signature · 1 line
2.30.2