diff mbox series

[05/13] nvmem: change the signature of nvmem_unregister()

Message ID 20180905095738.26406-6-brgl@bgdev.pl (mailing list archive)
State Superseded, archived
Headers show
Series nvmem: rework of the subsystem for non-DT users | expand

Commit Message

Bartosz Golaszewski Sept. 5, 2018, 9:57 a.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

This function can no longer fail and there are no more users that check
it return value. Change it to return void.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/nvmem/core.c           | 8 ++------
 include/linux/nvmem-provider.h | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)

Comments

kernel test robot Sept. 7, 2018, 4:48 a.m. UTC | #1
Hi Bartosz,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc2 next-20180906]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/nvmem-rework-of-the-subsystem-for-non-DT-users/20180907-112400
config: i386-randconfig-s3-09061342 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/rtc.h:18:0,
                    from include/linux/efi.h:20,
                    from drivers//char/tpm/eventlog/tpm1.c:24:
   include/linux/nvmem-provider.h: In function 'nvmem_unregister':
>> include/linux/nvmem-provider.h:86:9: warning: 'return' with a value, in function returning void
     return -ENOSYS;
            ^
   include/linux/nvmem-provider.h:84:20: note: declared here
    static inline void nvmem_unregister(struct nvmem_device *nvmem)
                       ^~~~~~~~~~~~~~~~
   include/linux/nvmem-provider.h: In function 'devm_nvmem_unregister':
>> include/linux/nvmem-provider.h:98:9: error: void value not ignored as it ought to be
     return nvmem_unregister(nvmem);
            ^~~~~~~~~~~~~~~~~~~~~~~

vim +98 include/linux/nvmem-provider.h

eace75cf Srinivas Kandagatla 2015-07-27  83  
fd7df99e Bartosz Golaszewski 2018-09-05  84  static inline void nvmem_unregister(struct nvmem_device *nvmem)
eace75cf Srinivas Kandagatla 2015-07-27  85  {
eace75cf Srinivas Kandagatla 2015-07-27 @86  	return -ENOSYS;
eace75cf Srinivas Kandagatla 2015-07-27  87  }
eace75cf Srinivas Kandagatla 2015-07-27  88  
f1f50eca Andrey Smirnov      2018-03-09  89  static inline struct nvmem_device *
f1f50eca Andrey Smirnov      2018-03-09  90  devm_nvmem_register(struct device *dev, const struct nvmem_config *c)
f1f50eca Andrey Smirnov      2018-03-09  91  {
f1f50eca Andrey Smirnov      2018-03-09  92  	return nvmem_register(c);
f1f50eca Andrey Smirnov      2018-03-09  93  }
f1f50eca Andrey Smirnov      2018-03-09  94  
f1f50eca Andrey Smirnov      2018-03-09  95  static inline int
f1f50eca Andrey Smirnov      2018-03-09  96  devm_nvmem_unregister(struct device *dev, struct nvmem_device *nvmem)
f1f50eca Andrey Smirnov      2018-03-09  97  {
f1f50eca Andrey Smirnov      2018-03-09 @98  	return nvmem_unregister(nvmem);
b3db17e4 Andrew Lunn         2018-05-11  99  

:::::: The code at line 98 was first introduced by commit
:::::: f1f50eca5f90527d2cca3479cda08883958777f6 nvmem: Introduce devm_nvmem_(un)register()

:::::: TO: Andrey Smirnov <andrew.smirnov@gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Sept. 7, 2018, 4:57 a.m. UTC | #2
Hi Bartosz,

I love your patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.19-rc2 next-20180906]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Bartosz-Golaszewski/nvmem-rework-of-the-subsystem-for-non-DT-users/20180907-112400
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=xtensa 

All error/warnings (new ones prefixed by >>):

   drivers//nvmem/mxs-ocotp.c: In function 'mxs_ocotp_remove':
>> drivers//nvmem/mxs-ocotp.c:202:9: error: void value not ignored as it ought to be
     return nvmem_unregister(otp->nvmem);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers//nvmem/mxs-ocotp.c:203:1: warning: control reaches end of non-void function [-Wreturn-type]
    }
    ^

vim +202 drivers//nvmem/mxs-ocotp.c

c01e9a11 Stefan Wahren 2015-09-30  195  
c01e9a11 Stefan Wahren 2015-09-30  196  static int mxs_ocotp_remove(struct platform_device *pdev)
c01e9a11 Stefan Wahren 2015-09-30  197  {
c01e9a11 Stefan Wahren 2015-09-30  198  	struct mxs_ocotp *otp = platform_get_drvdata(pdev);
c01e9a11 Stefan Wahren 2015-09-30  199  
c01e9a11 Stefan Wahren 2015-09-30  200  	clk_unprepare(otp->clk);
c01e9a11 Stefan Wahren 2015-09-30  201  
c01e9a11 Stefan Wahren 2015-09-30 @202  	return nvmem_unregister(otp->nvmem);
c01e9a11 Stefan Wahren 2015-09-30 @203  }
c01e9a11 Stefan Wahren 2015-09-30  204  

:::::: The code at line 202 was first introduced by commit
:::::: c01e9a11ab6f3096a54574c3224d8732a374f135 nvmem: add driver for ocotp in i.MX23 and i.MX28

:::::: TO: Stefan Wahren <stefan.wahren@i2se.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 2335b72d4b3e..89b91f73d08a 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -450,20 +450,16 @@  static void nvmem_device_release(struct kref *kref)
  * nvmem_unregister() - Unregister previously registered nvmem device
  *
  * @nvmem: Pointer to previously registered nvmem device.
- *
- * Return: Will be an negative on error or a zero on success.
  */
-int nvmem_unregister(struct nvmem_device *nvmem)
+void nvmem_unregister(struct nvmem_device *nvmem)
 {
 	kref_put(&nvmem->refcnt, nvmem_device_release);
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(nvmem_unregister);
 
 static void devm_nvmem_release(struct device *dev, void *res)
 {
-	WARN_ON(nvmem_unregister(*(struct nvmem_device **)res));
+	nvmem_unregister(*(struct nvmem_device **)res);
 }
 
 /**
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index cc8556e3c825..07ab1ea73520 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -67,7 +67,7 @@  struct nvmem_config {
 #if IS_ENABLED(CONFIG_NVMEM)
 
 struct nvmem_device *nvmem_register(const struct nvmem_config *cfg);
-int nvmem_unregister(struct nvmem_device *nvmem);
+void nvmem_unregister(struct nvmem_device *nvmem);
 
 struct nvmem_device *devm_nvmem_register(struct device *dev,
 					 const struct nvmem_config *cfg);
@@ -81,7 +81,7 @@  static inline struct nvmem_device *nvmem_register(const struct nvmem_config *c)
 	return ERR_PTR(-ENOSYS);
 }
 
-static inline int nvmem_unregister(struct nvmem_device *nvmem)
+static inline void nvmem_unregister(struct nvmem_device *nvmem)
 {
 	return -ENOSYS;
 }