All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/20] Make some spi device drivers return zero in .remove()
@ 2021-10-12 15:39 ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Alexandre Torgue, Arnd Bergmann, Bartosz Golaszewski,
	Dmitry Torokhov, Eric Piel, Greg Kroah-Hartman, Guenter Roeck,
	Hans de Goede, Jarkko Sakkinen, Jason Gunthorpe, Jean Delvare,
	Jiri Slaby, Lee Jones, Linus Walleij, Mark Gross,
	Mauro Carvalho Chehab, Maxime Coquelin, Michael Hennerich,
	Miquel Raynal, Peter Huewe, Richard Weinberger, Thierry Reding,
	Vignesh Raghavendra, Yasunari Takiguchi
  Cc: Andy Shevchenko, Colin Ian King, Dan Carpenter, Fabio Estevam,
	Heiko Schocher, Len Baker, Mark Brown, Phil Reid, Sam Ravnborg,
	Tudor Ambarus, dri-devel, kernel, linux-fbdev, linux-gpio,
	linux-hwmon, linux-input, linux-integrity, linux-kernel,
	linux-media, linux-mtd, linux-serial, linux-spi, linux-staging,
	linux-stm32, platform-driver-x86

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 <u.kleine-koenig@pengutronix.de>
         Acked-by: Michael Hennerich <michael.hennerich@analog.com>
    +    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
     
      ## 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
-- 
2.30.2


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 00/20] Make some spi device drivers return zero in .remove()
@ 2021-10-12 15:39 ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Alexandre Torgue, Arnd Bergmann, Bartosz Golaszewski,
	Dmitry Torokhov, Eric Piel, Greg Kroah-Hartman, Guenter Roeck,
	Hans de Goede, Jarkko Sakkinen, Jason Gunthorpe, Jean Delvare,
	Jiri Slaby, Lee Jones, Linus Walleij, Mark Gross,
	Mauro Carvalho Chehab, Maxime Coquelin, Michael Hennerich,
	Miquel Raynal, Peter Huewe, Richard Weinberger, Thierry Reding,
	Vignesh Raghavendra, Yasunari Takiguchi
  Cc: Andy Shevchenko, Colin Ian King, Dan Carpenter, Fabio Estevam,
	Heiko Schocher, Len Baker, Mark Brown, Phil Reid, Sam Ravnborg,
	Tudor Ambarus, dri-devel, kernel, linux-fbdev, linux-gpio,
	linux-hwmon, linux-input, linux-integrity, linux-kernel,
	linux-media, linux-mtd, linux-serial, linux-spi, linux-staging,
	linux-stm32, platform-driver-x86

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 <u.kleine-koenig@pengutronix.de>
         Acked-by: Michael Hennerich <michael.hennerich@analog.com>
    +    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
     
      ## 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
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH v2 01/20] drm/panel: s6e63m0: Make s6e63m0_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Mark Brown, Sam Ravnborg, dri-devel, kernel, linux-spi

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
index e0b1a7e354f3..e0f773678168 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-dsi.c
@@ -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[] = {
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
index 3669cc3719ce..c178d962b0d5 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0-spi.c
@@ -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[] = {
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
index 35d72ac663d6..b34fa4d5de07 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.c
@@ -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);
 
diff --git a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
index 306605ed1117..c926eca1c817 100644
--- a/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
+++ b/drivers/gpu/drm/panel/panel-samsung-s6e63m0.h
@@ -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 */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 02/20] gpio: max730x: Make __max730x_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
  (?)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-13 17:53   ` Bartosz Golaszewski
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij
  Cc: Mark Brown, kernel, linux-gpio, linux-spi

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>
---
 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(-)

diff --git a/drivers/gpio/gpio-max7300.c b/drivers/gpio/gpio-max7300.c
index 19cc2ed6a3f5..b2b547dd6e84 100644
--- a/drivers/gpio/gpio-max7300.c
+++ b/drivers/gpio/gpio-max7300.c
@@ -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[] = {
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index 1307c243b4e9..5862d73bf325 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -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[] = {
diff --git a/drivers/gpio/gpio-max730x.c b/drivers/gpio/gpio-max730x.c
index b8c1fe20f49a..bb5cf14ae4c8 100644
--- a/drivers/gpio/gpio-max730x.c
+++ b/drivers/gpio/gpio-max730x.c
@@ -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);
 
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h
index 21449067aedb..e392c53758bc 100644
--- a/include/linux/spi/max7301.h
+++ b/include/linux/spi/max7301.h
@@ -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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 03/20] gpio: mc33880: Drop if with an always false condition
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (2 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-13 17:53   ` Bartosz Golaszewski
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij
  Cc: Mark Brown, kernel, linux-gpio, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpio-mc33880.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index f8194f7c6186..31d2be1bebc8 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove()
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (3 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-12 15:51   ` Guenter Roeck
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: Mark Brown, kernel, linux-hwmon, linux-spi, Michael Hennerich

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.

Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/hwmon/max31722.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c
index 613338cbcb17..4cf4fe6809a3 100644
--- a/drivers/hwmon/max31722.c
+++ b/drivers/hwmon/max31722.c
@@ -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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (4 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-13  2:45   ` Dmitry Torokhov
  2021-10-13  7:49   ` Hennerich, Michael
  -1 siblings, 2 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Dmitry Torokhov, Michael Hennerich
  Cc: Mark Brown, kernel, linux-input, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
index e64368a63346..a3b5f88d2bd1 100644
--- a/drivers/input/misc/adxl34x-i2c.c
+++ b/drivers/input/misc/adxl34x-i2c.c
@@ -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.c b/drivers/input/misc/adxl34x-spi.c
index df6afa455e46..6e51c9bc619f 100644
--- a/drivers/input/misc/adxl34x-spi.c
+++ b/drivers/input/misc/adxl34x-spi.c
@@ -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.c b/drivers/input/misc/adxl34x.c
index 4cc4e8ff42b3..34beac80e6f0 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -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);
 
diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h
index 83a0eeccf613..febf85270fff 100644
--- a/drivers/input/misc/adxl34x.h
+++ b/drivers/input/misc/adxl34x.h
@@ -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


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 06/20] input: touchscreen: tsc200x: Make tsc200x_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (5 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-13  2:45   ` Dmitry Torokhov
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Mark Brown, kernel, linux-input, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/input/touchscreen/tsc2004.c b/drivers/input/touchscreen/tsc2004.c
index 0272cedcc726..9fdd870c4c0b 100644
--- a/drivers/input/touchscreen/tsc2004.c
+++ b/drivers/input/touchscreen/tsc2004.c
@@ -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[] = {
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 923496bbb368..a2f55920b9b2 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -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
diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c
index b8d720d52013..27810f6c69f6 100644
--- a/drivers/input/touchscreen/tsc200x-core.c
+++ b/drivers/input/touchscreen/tsc200x-core.c
@@ -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);
 
diff --git a/drivers/input/touchscreen/tsc200x-core.h b/drivers/input/touchscreen/tsc200x-core.h
index a43c08ccfd3d..4ded34425b21 100644
--- a/drivers/input/touchscreen/tsc200x-core.h
+++ b/drivers/input/touchscreen/tsc200x-core.h
@@ -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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 07/20] media: cxd2880: Eliminate dead code
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (6 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Yasunari Takiguchi
  Cc: Mark Brown, kernel, linux-media, linux-spi

An 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/media/spi/cxd2880-spi.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c
index b91a1e845b97..67cacf29a61e 100644
--- a/drivers/media/spi/cxd2880-spi.c
+++ b/drivers/media/spi/cxd2880-spi.c
@@ -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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 08/20] mfd: mc13xxx: Make mc13xxx_common_exit() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (7 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-21 10:18   ` Lee Jones
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Lee Jones; +Cc: Mark Brown, kernel, linux-kernel, linux-spi

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 1abe7432aad8..8a4f1d90dcfd 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -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);
 
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 65b4dd8e5afb..fb937f66277e 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -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 = {
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 286ddcf5ddc6..4d8913d647e6 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -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 = {
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index ce6eec52e8eb..bd5ba9a0e14f 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -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 */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 09/20] mfd: stmpe: Make stmpe_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (8 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-21 10:19   ` Lee Jones
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Alexandre Torgue, Lee Jones, Maxime Coquelin
  Cc: Mark Brown, kernel, linux-spi, linux-stm32

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c
index cd2f45257dc1..d3eedf3d607e 100644
--- a/drivers/mfd/stmpe-i2c.c
+++ b/drivers/mfd/stmpe-i2c.c
@@ -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[] = {
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index 7351734f7593..6c5915016be5 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -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[] = {
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index 58d09c615e67..e928df95e316 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -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
diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
index 83491e99ba3c..1b4f91d03bbf 100644
--- a/drivers/mfd/stmpe.h
+++ b/drivers/mfd/stmpe.h
@@ -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)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 10/20] mfd: tps65912: Make tps65912_device_exit() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (9 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-21 10:19   ` Lee Jones
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Lee Jones; +Cc: Mark Brown, kernel, linux-kernel, linux-spi

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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c
index b55b1d5d6955..c282a05e7146 100644
--- a/drivers/mfd/tps65912-core.c
+++ b/drivers/mfd/tps65912-core.c
@@ -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);
 
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c
index f7c22ea7b36c..06eb2784d322 100644
--- a/drivers/mfd/tps65912-i2c.c
+++ b/drivers/mfd/tps65912-i2c.c
@@ -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[] = {
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c
index 21a8d6ac5c4a..d701926aa46e 100644
--- a/drivers/mfd/tps65912-spi.c
+++ b/drivers/mfd/tps65912-spi.c
@@ -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[] = {
diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h
index 7943e413deae..8a61386cb8c1 100644
--- a/include/linux/mfd/tps65912.h
+++ b/include/linux/mfd/tps65912.h
@@ -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 */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (10 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-13  7:49   ` Hennerich, Michael
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Michael Hennerich
  Cc: Mark Brown, kernel, linux-kernel, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/misc/ad525x_dpot-i2c.c b/drivers/misc/ad525x_dpot-i2c.c
index bd869ec5edba..0ee0c6d808c3 100644
--- a/drivers/misc/ad525x_dpot-i2c.c
+++ b/drivers/misc/ad525x_dpot-i2c.c
@@ -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.c b/drivers/misc/ad525x_dpot-spi.c
index aea931dd272e..a9e75d80ad36 100644
--- a/drivers/misc/ad525x_dpot-spi.c
+++ b/drivers/misc/ad525x_dpot-spi.c
@@ -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.c b/drivers/misc/ad525x_dpot.c
index 5d8f3f6a95f2..756ef6912b5a 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -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);
 
diff --git a/drivers/misc/ad525x_dpot.h b/drivers/misc/ad525x_dpot.h
index ee8dc9f5a45a..72a9d6801937 100644
--- a/drivers/misc/ad525x_dpot.h
+++ b/drivers/misc/ad525x_dpot.h
@@ -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


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (11 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-12 15:54   ` Hans de Goede
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Arnd Bergmann, Eric Piel, Greg Kroah-Hartman, Hans de Goede, Mark Gross
  Cc: Mark Brown, kernel, linux-spi, platform-driver-x86

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 <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 70c5bb1e6f49..3a7808b796b1 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -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);
 
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h
index c394c0b08519..195bd2fd2eb5 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.h
+++ b/drivers/misc/lis3lv02d/lis3lv02d.h
@@ -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;
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
index f664ed123730..9e40dfb60742 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
@@ -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
diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
index cc53f725c041..b183967ecfb7 100644
--- a/drivers/platform/x86/hp_accel.c
+++ b/drivers/platform/x86/hp_accel.c
@@ -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
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
  2021-10-12 15:39 ` Uwe Kleine-König
@ 2021-10-12 15:39   ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, Tudor Ambarus, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 9802e265fca8..2691b6b79df8 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -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 = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
@ 2021-10-12 15:39   ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, Tudor Ambarus, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index 9802e265fca8..2691b6b79df8 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -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 = {
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 14/20] mtd: mchp23k256: Warn about failure to unregister mtd device
  2021-10-12 15:39 ` Uwe Kleine-König
@ 2021-10-12 15:39   ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mchp23k256.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
index 77c872fd3d83..23213009ebf4 100644
--- a/drivers/mtd/devices/mchp23k256.c
+++ b/drivers/mtd/devices/mchp23k256.c
@@ -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[] = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 14/20] mtd: mchp23k256: Warn about failure to unregister mtd device
@ 2021-10-12 15:39   ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mchp23k256.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c
index 77c872fd3d83..23213009ebf4 100644
--- a/drivers/mtd/devices/mchp23k256.c
+++ b/drivers/mtd/devices/mchp23k256.c
@@ -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[] = {
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 15/20] mtd: mchp48l640: Warn about failure to unregister mtd device
  2021-10-12 15:39 ` Uwe Kleine-König
@ 2021-10-12 15:39   ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Colin Ian King, Dan Carpenter, Fabio Estevam, Heiko Schocher,
	Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mchp48l640.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c
index 99400d0fb8c1..b87f7eca3e64 100644
--- a/drivers/mtd/devices/mchp48l640.c
+++ b/drivers/mtd/devices/mchp48l640.c
@@ -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[] = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 15/20] mtd: mchp48l640: Warn about failure to unregister mtd device
@ 2021-10-12 15:39   ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Colin Ian King, Dan Carpenter, Fabio Estevam, Heiko Schocher,
	Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/mchp48l640.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c
index 99400d0fb8c1..b87f7eca3e64 100644
--- a/drivers/mtd/devices/mchp48l640.c
+++ b/drivers/mtd/devices/mchp48l640.c
@@ -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[] = {
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 16/20] mtd: sst25l: Warn about failure to unregister mtd device
  2021-10-12 15:39 ` Uwe Kleine-König
@ 2021-10-12 15:39   ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/sst25l.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index b81c3f0b85f9..04062a1f54c1 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -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 = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 16/20] mtd: sst25l: Warn about failure to unregister mtd device
@ 2021-10-12 15:39   ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
  Cc: Mark Brown, kernel, linux-mtd, linux-spi

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 <u.kleine-koenig@pengutronix.de>
---
 drivers/mtd/devices/sst25l.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index b81c3f0b85f9..04062a1f54c1 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -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 = {
-- 
2.30.2


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 17/20] serial: max310x: Make max310x_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (16 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mark Brown, kernel, linux-serial, linux-spi

Up 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/max310x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 3df0788ddeb0..dde0824b2fa5 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1426,7 +1426,7 @@ static int max310x_probe(struct device *dev, const struct max310x_devtype *devty
 	return 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[] = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 18/20] serial: sc16is7xx: Make sc16is7xx_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (17 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby
  Cc: Mark Brown, kernel, linux-serial, linux-spi

Up 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/tty/serial/sc16is7xx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index acbb615dd28f..64e7e6c8145f 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -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[] = {
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 19/20] staging: fbtft: Make fbtft_remove_common() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (18 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  2021-10-12 18:41   ` Andy Shevchenko
  -1 siblings, 1 reply; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Andy Shevchenko, Len Baker, Mark Brown, Phil Reid, dri-devel,
	kernel, linux-fbdev, linux-spi, linux-staging

fbtft_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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/staging/fbtft/fbtft-core.c | 8 +-------
 drivers/staging/fbtft/fbtft.h      | 8 +++++---
 2 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index ed992ca605eb..9c9eab1182a6 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -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);
 
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 76f8c090a837..6869f3603b0e 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -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


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH v2 20/20] tpm: st33zp24: Make st33zp24_remove() return void
  2021-10-12 15:39 ` Uwe Kleine-König
                   ` (19 preceding siblings ...)
  (?)
@ 2021-10-12 15:39 ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-12 15:39 UTC (permalink / raw)
  To: Jarkko Sakkinen, Jason Gunthorpe, Peter Huewe
  Cc: Mark Brown, kernel, linux-integrity, linux-spi

Up 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.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 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(-)

diff --git a/drivers/char/tpm/st33zp24/i2c.c b/drivers/char/tpm/st33zp24/i2c.c
index 7c617edff4ca..3170d59d660c 100644
--- a/drivers/char/tpm/st33zp24/i2c.c
+++ b/drivers/char/tpm/st33zp24/i2c.c
@@ -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;
 }
diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
index a75dafd39445..ccd9e42b8eab 100644
--- a/drivers/char/tpm/st33zp24/spi.c
+++ b/drivers/char/tpm/st33zp24/spi.c
@@ -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;
 }
diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c
index 4ec10ab5e576..2b63654c38d6 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.c
+++ b/drivers/char/tpm/st33zp24/st33zp24.c
@@ -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);
 
diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h
index 6747be1e2502..b387a476c555 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.h
+++ b/drivers/char/tpm/st33zp24/st33zp24.h
@@ -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__ */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove()
  2021-10-12 15:39 ` [PATCH v2 04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove() Uwe Kleine-König
@ 2021-10-12 15:51   ` Guenter Roeck
  0 siblings, 0 replies; 47+ messages in thread
From: Guenter Roeck @ 2021-10-12 15:51 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Jean Delvare, Mark Brown, kernel, linux-hwmon, linux-spi,
	Michael Hennerich

On Tue, Oct 12, 2021 at 05:39:29PM +0200, Uwe Kleine-König wrote:
> 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.
> 
> Acked-by: Michael Hennerich <michael.hennerich@analog.com>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied to hwmon-next.

Thanks,
Guenter

> ---
>  drivers/hwmon/max31722.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/max31722.c b/drivers/hwmon/max31722.c
> index 613338cbcb17..4cf4fe6809a3 100644
> --- a/drivers/hwmon/max31722.c
> +++ b/drivers/hwmon/max31722.c
> @@ -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)

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
  2021-10-12 15:39 ` [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() " Uwe Kleine-König
@ 2021-10-12 15:54   ` Hans de Goede
  2021-10-13  9:01     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 47+ messages in thread
From: Hans de Goede @ 2021-10-12 15:54 UTC (permalink / raw)
  To: Uwe Kleine-König, Arnd Bergmann, Eric Piel,
	Greg Kroah-Hartman, Mark Gross
  Cc: Mark Brown, kernel, linux-spi, platform-driver-x86

Hi,

On 10/12/21 5:39 PM, Uwe Kleine-König wrote:
> 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 <u.kleine-koenig@pengutronix.de>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Also please consider this as my ack for merging the
drivers/platform/x86/ part of this through whatever
tree is convenient.

Regards,

Hans

> ---
>  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(-)
> 
> diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
> index 70c5bb1e6f49..3a7808b796b1 100644
> --- a/drivers/misc/lis3lv02d/lis3lv02d.c
> +++ b/drivers/misc/lis3lv02d/lis3lv02d.c
> @@ -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);
>  
> diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h
> index c394c0b08519..195bd2fd2eb5 100644
> --- a/drivers/misc/lis3lv02d/lis3lv02d.h
> +++ b/drivers/misc/lis3lv02d/lis3lv02d.h
> @@ -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;
> diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
> index f664ed123730..9e40dfb60742 100644
> --- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c
> +++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
> @@ -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
> diff --git a/drivers/platform/x86/hp_accel.c b/drivers/platform/x86/hp_accel.c
> index cc53f725c041..b183967ecfb7 100644
> --- a/drivers/platform/x86/hp_accel.c
> +++ b/drivers/platform/x86/hp_accel.c
> @@ -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
> 


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 19/20] staging: fbtft: Make fbtft_remove_common() return void
  2021-10-12 15:39 ` [PATCH v2 19/20] staging: fbtft: Make fbtft_remove_common() " Uwe Kleine-König
@ 2021-10-12 18:41   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2021-10-12 18:41 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Greg Kroah-Hartman, Andy Shevchenko, Len Baker, Mark Brown,
	Phil Reid, dri-devel, Sascha Hauer, open list:FRAMEBUFFER LAYER,
	linux-spi, linux-staging

On Tue, Oct 12, 2021 at 6:40 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> fbtft_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.

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/staging/fbtft/fbtft-core.c | 8 +-------
>  drivers/staging/fbtft/fbtft.h      | 8 +++++---
>  2 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index ed992ca605eb..9c9eab1182a6 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -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);
>
> diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
> index 76f8c090a837..6869f3603b0e 100644
> --- a/drivers/staging/fbtft/fbtft.h
> +++ b/drivers/staging/fbtft/fbtft.h
> @@ -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
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
  2021-10-12 15:39 ` [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void Uwe Kleine-König
@ 2021-10-13  2:45   ` Dmitry Torokhov
  2021-10-13  7:49   ` Hennerich, Michael
  1 sibling, 0 replies; 47+ messages in thread
From: Dmitry Torokhov @ 2021-10-13  2:45 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Michael Hennerich, Mark Brown, kernel, linux-input, linux-spi

On Tue, Oct 12, 2021 at 05:39:30PM +0200, Uwe Kleine-König wrote:
> 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 <u.kleine-koenig@pengutronix.de>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 06/20] input: touchscreen: tsc200x: Make tsc200x_remove() return void
  2021-10-12 15:39 ` [PATCH v2 06/20] input: touchscreen: tsc200x: Make tsc200x_remove() " Uwe Kleine-König
@ 2021-10-13  2:45   ` Dmitry Torokhov
  0 siblings, 0 replies; 47+ messages in thread
From: Dmitry Torokhov @ 2021-10-13  2:45 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Mark Brown, kernel, linux-input, linux-spi

On Tue, Oct 12, 2021 at 05:39:31PM +0200, Uwe Kleine-König wrote:
> 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 <u.kleine-koenig@pengutronix.de>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() return void
  2021-10-12 15:39 ` [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() " Uwe Kleine-König
@ 2021-10-13  7:49   ` Hennerich, Michael
  0 siblings, 0 replies; 47+ messages in thread
From: Hennerich, Michael @ 2021-10-13  7:49 UTC (permalink / raw)
  To: Uwe Kleine-König, Arnd Bergmann, Greg Kroah-Hartman
  Cc: Mark Brown, kernel, linux-kernel, linux-spi



> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Sent: Dienstag, 12. Oktober 2021 17:40
> To: Arnd Bergmann <arnd@arndb.de>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Hennerich, Michael
> <Michael.Hennerich@analog.com>
> Cc: Mark Brown <broonie@kernel.org>; kernel@pengutronix.de; linux-
> kernel@vger.kernel.org; linux-spi@vger.kernel.org
> Subject: [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() return
> void
> 
> 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 <u.kleine-koenig@pengutronix.de>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  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(-)
> 
> diff --git a/drivers/misc/ad525x_dpot-i2c.c b/drivers/misc/ad525x_dpot-i2c.c
> index bd869ec5edba..0ee0c6d808c3 100644
> --- a/drivers/misc/ad525x_dpot-i2c.c
> +++ b/drivers/misc/ad525x_dpot-i2c.c
> @@ -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.c b/drivers/misc/ad525x_dpot-spi.c index
> aea931dd272e..a9e75d80ad36 100644
> --- a/drivers/misc/ad525x_dpot-spi.c
> +++ b/drivers/misc/ad525x_dpot-spi.c
> @@ -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.c b/drivers/misc/ad525x_dpot.c index
> 5d8f3f6a95f2..756ef6912b5a 100644
> --- a/drivers/misc/ad525x_dpot.c
> +++ b/drivers/misc/ad525x_dpot.c
> @@ -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);
> 
> diff --git a/drivers/misc/ad525x_dpot.h b/drivers/misc/ad525x_dpot.h index
> ee8dc9f5a45a..72a9d6801937 100644
> --- a/drivers/misc/ad525x_dpot.h
> +++ b/drivers/misc/ad525x_dpot.h
> @@ -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


^ permalink raw reply	[flat|nested] 47+ messages in thread

* RE: [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
  2021-10-12 15:39 ` [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void Uwe Kleine-König
  2021-10-13  2:45   ` Dmitry Torokhov
@ 2021-10-13  7:49   ` Hennerich, Michael
  1 sibling, 0 replies; 47+ messages in thread
From: Hennerich, Michael @ 2021-10-13  7:49 UTC (permalink / raw)
  To: Uwe Kleine-König, Dmitry Torokhov
  Cc: Mark Brown, kernel, linux-input, linux-spi



> -----Original Message-----
> From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Sent: Dienstag, 12. Oktober 2021 17:40
> To: Dmitry Torokhov <dmitry.torokhov@gmail.com>; Hennerich, Michael
> <Michael.Hennerich@analog.com>
> Cc: Mark Brown <broonie@kernel.org>; kernel@pengutronix.de; linux-
> input@vger.kernel.org; linux-spi@vger.kernel.org
> Subject: [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void
> 
> 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 <u.kleine-koenig@pengutronix.de>

Acked-by: Michael Hennerich <michael.hennerich@analog.com>

> ---
>  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(-)
> 
> diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c
> index e64368a63346..a3b5f88d2bd1 100644
> --- a/drivers/input/misc/adxl34x-i2c.c
> +++ b/drivers/input/misc/adxl34x-i2c.c
> @@ -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.c b/drivers/input/misc/adxl34x-spi.c
> index df6afa455e46..6e51c9bc619f 100644
> --- a/drivers/input/misc/adxl34x-spi.c
> +++ b/drivers/input/misc/adxl34x-spi.c
> @@ -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.c b/drivers/input/misc/adxl34x.c index
> 4cc4e8ff42b3..34beac80e6f0 100644
> --- a/drivers/input/misc/adxl34x.c
> +++ b/drivers/input/misc/adxl34x.c
> @@ -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);
> 
> diff --git a/drivers/input/misc/adxl34x.h b/drivers/input/misc/adxl34x.h index
> 83a0eeccf613..febf85270fff 100644
> --- a/drivers/input/misc/adxl34x.h
> +++ b/drivers/input/misc/adxl34x.h
> @@ -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


^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() return void
  2021-10-12 15:54   ` Hans de Goede
@ 2021-10-13  9:01     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 47+ messages in thread
From: Greg Kroah-Hartman @ 2021-10-13  9:01 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Uwe Kleine-König, Arnd Bergmann, Eric Piel, Mark Gross,
	Mark Brown, kernel, linux-spi, platform-driver-x86

On Tue, Oct 12, 2021 at 05:54:46PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 10/12/21 5:39 PM, Uwe Kleine-König wrote:
> > 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 <u.kleine-koenig@pengutronix.de>
> 
> Thanks, patch looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> 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

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
  2021-10-12 15:39   ` Uwe Kleine-König
@ 2021-10-13 12:44     ` Miquel Raynal
  -1 siblings, 0 replies; 47+ messages in thread
From: Miquel Raynal @ 2021-10-13 12:44 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Richard Weinberger, Vignesh Raghavendra, Mark Brown,
	Tudor Ambarus, kernel, linux-mtd, linux-spi

Hi Uwe,

u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:

> When an spi driver's remove function returns a non-zero error code

Should we s/an spi/a SPI/?

> 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 <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> index 9802e265fca8..2691b6b79df8 100644
> --- a/drivers/mtd/devices/mtd_dataflash.c
> +++ b/drivers/mtd/devices/mtd_dataflash.c
> @@ -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()

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
@ 2021-10-13 12:44     ` Miquel Raynal
  0 siblings, 0 replies; 47+ messages in thread
From: Miquel Raynal @ 2021-10-13 12:44 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Richard Weinberger, Vignesh Raghavendra, Mark Brown,
	Tudor Ambarus, kernel, linux-mtd, linux-spi

Hi Uwe,

u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:

> When an spi driver's remove function returns a non-zero error code

Should we s/an spi/a SPI/?

> 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 <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> index 9802e265fca8..2691b6b79df8 100644
> --- a/drivers/mtd/devices/mtd_dataflash.c
> +++ b/drivers/mtd/devices/mtd_dataflash.c
> @@ -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()

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
  2021-10-13 12:44     ` Miquel Raynal
@ 2021-10-13 14:08       ` Uwe Kleine-König
  -1 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-13 14:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	linux-spi, Mark Brown, linux-mtd, kernel

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:
> Hi Uwe,
> 
> u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:
> 
> > 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.
 
> > 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 <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> > index 9802e265fca8..2691b6b79df8 100644
> > --- a/drivers/mtd/devices/mtd_dataflash.c
> > +++ b/drivers/mtd/devices/mtd_dataflash.c
> > @@ -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?

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
@ 2021-10-13 14:08       ` Uwe Kleine-König
  0 siblings, 0 replies; 47+ messages in thread
From: Uwe Kleine-König @ 2021-10-13 14:08 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	linux-spi, Mark Brown, linux-mtd, kernel


[-- Attachment #1.1: Type: text/plain, Size: 2177 bytes --]

On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:
> Hi Uwe,
> 
> u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:
> 
> > 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.
 
> > 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 <u.kleine-koenig@pengutronix.de>
> > ---
> >  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> > index 9802e265fca8..2691b6b79df8 100644
> > --- a/drivers/mtd/devices/mtd_dataflash.c
> > +++ b/drivers/mtd/devices/mtd_dataflash.c
> > @@ -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?

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

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
  2021-10-13 14:08       ` Uwe Kleine-König
@ 2021-10-13 14:33         ` Miquel Raynal
  -1 siblings, 0 replies; 47+ messages in thread
From: Miquel Raynal @ 2021-10-13 14:33 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	linux-spi, Mark Brown, linux-mtd, kernel

Hi Uwe,

u.kleine-koenig@pengutronix.de wrote on Wed, 13 Oct 2021 16:08:35 +0200:

> On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:
> > Hi Uwe,
> > 
> > u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:
> >   
> > > 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.

> 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 :)

> > > 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 <u.kleine-koenig@pengutronix.de>
> > > ---
> > >  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/mtd/devices/mtd_dataflash.c
> > > b/drivers/mtd/devices/mtd_dataflash.c index
> > > 9802e265fca8..2691b6b79df8 100644 ---
> > > a/drivers/mtd/devices/mtd_dataflash.c +++
> > > b/drivers/mtd/devices/mtd_dataflash.c @@ -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?  
> 
> 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.

Then let's all use WARN_ON() for now.

Thanks,
Miquèl

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
@ 2021-10-13 14:33         ` Miquel Raynal
  0 siblings, 0 replies; 47+ messages in thread
From: Miquel Raynal @ 2021-10-13 14:33 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Vignesh Raghavendra, Tudor Ambarus, Richard Weinberger,
	linux-spi, Mark Brown, linux-mtd, kernel

Hi Uwe,

u.kleine-koenig@pengutronix.de wrote on Wed, 13 Oct 2021 16:08:35 +0200:

> On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:
> > Hi Uwe,
> > 
> > u.kleine-koenig@pengutronix.de wrote on Tue, 12 Oct 2021 17:39:38 +0200:
> >   
> > > 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.

> 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 :)

> > > 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 <u.kleine-koenig@pengutronix.de>
> > > ---
> > >  drivers/mtd/devices/mtd_dataflash.c | 5 ++++-
> > >  1 file changed, 4 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/mtd/devices/mtd_dataflash.c
> > > b/drivers/mtd/devices/mtd_dataflash.c index
> > > 9802e265fca8..2691b6b79df8 100644 ---
> > > a/drivers/mtd/devices/mtd_dataflash.c +++
> > > b/drivers/mtd/devices/mtd_dataflash.c @@ -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?  
> 
> 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.

Then let's all use WARN_ON() for now.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
  2021-10-13 14:33         ` Miquel Raynal
@ 2021-10-13 15:13           ` Mark Brown
  -1 siblings, 0 replies; 47+ messages in thread
From: Mark Brown @ 2021-10-13 15:13 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Uwe Kleine-König, Vignesh Raghavendra, Tudor Ambarus,
	Richard Weinberger, linux-spi, linux-mtd, kernel

[-- Attachment #1: Type: text/plain, Size: 632 bytes --]

On Wed, Oct 13, 2021 at 04:33:57PM +0200, Miquel Raynal wrote:
> > On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:

> > 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device
@ 2021-10-13 15:13           ` Mark Brown
  0 siblings, 0 replies; 47+ messages in thread
From: Mark Brown @ 2021-10-13 15:13 UTC (permalink / raw)
  To: Miquel Raynal
  Cc: Uwe Kleine-König, Vignesh Raghavendra, Tudor Ambarus,
	Richard Weinberger, linux-spi, linux-mtd, kernel


[-- Attachment #1.1: Type: text/plain, Size: 632 bytes --]

On Wed, Oct 13, 2021 at 04:33:57PM +0200, Miquel Raynal wrote:
> > On Wed, Oct 13, 2021 at 02:44:29PM +0200, Miquel Raynal wrote:

> > 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.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 02/20] gpio: max730x: Make __max730x_remove() return void
  2021-10-12 15:39 ` [PATCH v2 02/20] gpio: max730x: Make __max730x_remove() " Uwe Kleine-König
@ 2021-10-13 17:53   ` Bartosz Golaszewski
  0 siblings, 0 replies; 47+ messages in thread
From: Bartosz Golaszewski @ 2021-10-13 17:53 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Mark Brown, Sascha Hauer,
	open list:GPIO SUBSYSTEM, linux-spi

On Tue, Oct 12, 2021 at 5:39 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> 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>
> ---

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 03/20] gpio: mc33880: Drop if with an always false condition
  2021-10-12 15:39 ` [PATCH v2 03/20] gpio: mc33880: Drop if with an always false condition Uwe Kleine-König
@ 2021-10-13 17:53   ` Bartosz Golaszewski
  0 siblings, 0 replies; 47+ messages in thread
From: Bartosz Golaszewski @ 2021-10-13 17:53 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Linus Walleij, Mark Brown, Sascha Hauer,
	open list:GPIO SUBSYSTEM, linux-spi

On Tue, Oct 12, 2021 at 5:39 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
>
> 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 <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/gpio/gpio-mc33880.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
> index f8194f7c6186..31d2be1bebc8 100644
> --- a/drivers/gpio/gpio-mc33880.c
> +++ b/drivers/gpio/gpio-mc33880.c
> @@ -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);
> --
> 2.30.2
>

Applied, thanks!

Bart

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 08/20] mfd: mc13xxx: Make mc13xxx_common_exit() return void
  2021-10-12 15:39 ` [PATCH v2 08/20] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
@ 2021-10-21 10:18   ` Lee Jones
  0 siblings, 0 replies; 47+ messages in thread
From: Lee Jones @ 2021-10-21 10:18 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Mark Brown, kernel, linux-kernel, linux-spi

On Tue, 12 Oct 2021, Uwe Kleine-König wrote:

> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  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.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 09/20] mfd: stmpe: Make stmpe_remove() return void
  2021-10-12 15:39 ` [PATCH v2 09/20] mfd: stmpe: Make stmpe_remove() " Uwe Kleine-König
@ 2021-10-21 10:19   ` Lee Jones
  0 siblings, 0 replies; 47+ messages in thread
From: Lee Jones @ 2021-10-21 10:19 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Alexandre Torgue, Maxime Coquelin, Mark Brown, kernel, linux-spi,
	linux-stm32

On Tue, 12 Oct 2021, Uwe Kleine-König wrote:

> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  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.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH v2 10/20] mfd: tps65912: Make tps65912_device_exit() return void
  2021-10-12 15:39 ` [PATCH v2 10/20] mfd: tps65912: Make tps65912_device_exit() " Uwe Kleine-König
@ 2021-10-21 10:19   ` Lee Jones
  0 siblings, 0 replies; 47+ messages in thread
From: Lee Jones @ 2021-10-21 10:19 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Mark Brown, kernel, linux-kernel, linux-spi

On Tue, 12 Oct 2021, Uwe Kleine-König wrote:

> 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  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.

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2021-10-21 10:19 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12 15:39 [PATCH v2 00/20] Make some spi device drivers return zero in .remove() Uwe Kleine-König
2021-10-12 15:39 ` Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 01/20] drm/panel: s6e63m0: Make s6e63m0_remove() return void Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 02/20] gpio: max730x: Make __max730x_remove() " Uwe Kleine-König
2021-10-13 17:53   ` Bartosz Golaszewski
2021-10-12 15:39 ` [PATCH v2 03/20] gpio: mc33880: Drop if with an always false condition Uwe Kleine-König
2021-10-13 17:53   ` Bartosz Golaszewski
2021-10-12 15:39 ` [PATCH v2 04/20] hwmon: max31722: Warn about failure to put device in stand-by in .remove() Uwe Kleine-König
2021-10-12 15:51   ` Guenter Roeck
2021-10-12 15:39 ` [PATCH v2 05/20] input: adxl34xx: Make adxl34x_remove() return void Uwe Kleine-König
2021-10-13  2:45   ` Dmitry Torokhov
2021-10-13  7:49   ` Hennerich, Michael
2021-10-12 15:39 ` [PATCH v2 06/20] input: touchscreen: tsc200x: Make tsc200x_remove() " Uwe Kleine-König
2021-10-13  2:45   ` Dmitry Torokhov
2021-10-12 15:39 ` [PATCH v2 07/20] media: cxd2880: Eliminate dead code Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 08/20] mfd: mc13xxx: Make mc13xxx_common_exit() return void Uwe Kleine-König
2021-10-21 10:18   ` Lee Jones
2021-10-12 15:39 ` [PATCH v2 09/20] mfd: stmpe: Make stmpe_remove() " Uwe Kleine-König
2021-10-21 10:19   ` Lee Jones
2021-10-12 15:39 ` [PATCH v2 10/20] mfd: tps65912: Make tps65912_device_exit() " Uwe Kleine-König
2021-10-21 10:19   ` Lee Jones
2021-10-12 15:39 ` [PATCH v2 11/20] misc: ad525x_dpot: Make ad_dpot_remove() " Uwe Kleine-König
2021-10-13  7:49   ` Hennerich, Michael
2021-10-12 15:39 ` [PATCH v2 12/20] misc: lis3lv02d: Make lis3lv02d_remove_fs() " Uwe Kleine-König
2021-10-12 15:54   ` Hans de Goede
2021-10-13  9:01     ` Greg Kroah-Hartman
2021-10-12 15:39 ` [PATCH v2 13/20] mtd: dataflash: Warn about failure to unregister mtd device Uwe Kleine-König
2021-10-12 15:39   ` Uwe Kleine-König
2021-10-13 12:44   ` Miquel Raynal
2021-10-13 12:44     ` Miquel Raynal
2021-10-13 14:08     ` Uwe Kleine-König
2021-10-13 14:08       ` Uwe Kleine-König
2021-10-13 14:33       ` Miquel Raynal
2021-10-13 14:33         ` Miquel Raynal
2021-10-13 15:13         ` Mark Brown
2021-10-13 15:13           ` Mark Brown
2021-10-12 15:39 ` [PATCH v2 14/20] mtd: mchp23k256: " Uwe Kleine-König
2021-10-12 15:39   ` Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 15/20] mtd: mchp48l640: " Uwe Kleine-König
2021-10-12 15:39   ` Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 16/20] mtd: sst25l: " Uwe Kleine-König
2021-10-12 15:39   ` Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 17/20] serial: max310x: Make max310x_remove() return void Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 18/20] serial: sc16is7xx: Make sc16is7xx_remove() " Uwe Kleine-König
2021-10-12 15:39 ` [PATCH v2 19/20] staging: fbtft: Make fbtft_remove_common() " Uwe Kleine-König
2021-10-12 18:41   ` Andy Shevchenko
2021-10-12 15:39 ` [PATCH v2 20/20] tpm: st33zp24: Make st33zp24_remove() " Uwe Kleine-König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.