All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 01/13] leds: core: The -ENOTSUPP should never be seen by user space
@ 2021-05-29 11:19 Andy Shevchenko
  2021-05-29 11:19 ` [PATCH v2 02/13] leds: el15203000: Give better margin for usleep_range() Andy Shevchenko
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Andy Shevchenko @ 2021-05-29 11:19 UTC (permalink / raw)
  To: Pavel Machek, Andy Shevchenko, Amireddy Mallikarjuna reddy,
	Linus Walleij, Abanoub Sameh, Marek Behún,
	Krzysztof Kozlowski, linux-leds, linux-kernel
  Cc: Jacek Anaszewski

Luckily there is no user which checks for returned code and actually
returns it, but since the function is exported any user may try to return
an error code from it to user space, usually during probe phase,

Replace -ENOTSUPP by -EOPNOTSUPP when returning from exported function.

Fixes: 13ae79bbe4c2 ("leds: core: Drivers shouldn't enforce SYNC/ASYNC brightness setting")
Cc: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
v2: amended the commit message
 drivers/leds/led-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index d56ff4939492..f962620a504f 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -289,6 +289,8 @@ EXPORT_SYMBOL_GPL(led_set_brightness_nosleep);
 
 int led_set_brightness_sync(struct led_classdev *led_cdev, unsigned int value)
 {
+	int ret;
+
 	if (led_cdev->blink_delay_on || led_cdev->blink_delay_off)
 		return -EBUSY;
 
@@ -297,7 +299,10 @@ int led_set_brightness_sync(struct led_classdev *led_cdev, unsigned int value)
 	if (led_cdev->flags & LED_SUSPENDED)
 		return 0;
 
-	return __led_set_brightness_blocking(led_cdev, led_cdev->brightness);
+	ret = __led_set_brightness_blocking(led_cdev, led_cdev->brightness);
+	if (ret == -ENOTSUPP)
+		return -EOPNOTSUPP;
+	return ret;
 }
 EXPORT_SYMBOL_GPL(led_set_brightness_sync);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* Re: [PATCH v2 09/13] leds: lm3697: Update header block to reflect reality
@ 2021-05-29 15:19 kernel test robot
  0 siblings, 0 replies; 21+ messages in thread
From: kernel test robot @ 2021-05-29 15:19 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210529111935.3849707-9-andy.shevchenko@gmail.com>
References: <20210529111935.3849707-9-andy.shevchenko@gmail.com>
TO: Andy Shevchenko <andy.shevchenko@gmail.com>
TO: Pavel Machek <pavel@ucw.cz>
TO: Andy Shevchenko <andy.shevchenko@gmail.com>
TO: Amireddy Mallikarjuna reddy <mallikarjunax.reddy@linux.intel.com>
TO: Linus Walleij <linus.walleij@linaro.org>
TO: Abanoub Sameh <abanoubsameh8@gmail.com>
TO: "Marek Behún" <marek.behun@nic.cz>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: linux-leds(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pavel-linux-leds/for-next]
[also build test WARNING on v5.13-rc3 next-20210528]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/leds-core-The-ENOTSUPP-should-never-be-seen-by-user-space/20210529-192239
base:   git://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git for-next
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: x86_64-randconfig-b001-20210529 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bc6799f2f79f0ae87e9f1ebf9d25ba799fbd25a9)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # apt-get install iwyu # include-what-you-use
        # https://github.com/0day-ci/linux/commit/85ddaa7971fae2bf4f13554df7d78123a10d0180
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/leds-core-The-ENOTSUPP-should-never-be-seen-by-user-space/20210529-192239
        git checkout 85ddaa7971fae2bf4f13554df7d78123a10d0180
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross C=1 CHECK=iwyu ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


iwyu warnings: (new ones prefixed by >>)
>> drivers/leds/leds-lm3697.c:5:1: iwyu: warning: superfluous #include <linux/bits.h>
>> drivers/leds/leds-lm3697.c:13:1: iwyu: warning: superfluous #include <linux/types.h>

vim +5 drivers/leds/leds-lm3697.c

5c1d824cda9f60 Dan Murphy      2019-05-06   4  
85ddaa7971fae2 Andy Shevchenko 2021-05-29  @5  #include <linux/bits.h>
5c1d824cda9f60 Dan Murphy      2019-05-06   6  #include <linux/gpio/consumer.h>
5c1d824cda9f60 Dan Murphy      2019-05-06   7  #include <linux/i2c.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29   8  #include <linux/mod_devicetable.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29   9  #include <linux/module.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29  10  #include <linux/property.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29  11  #include <linux/regmap.h>
5c1d824cda9f60 Dan Murphy      2019-05-06  12  #include <linux/regulator/consumer.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29 @13  #include <linux/types.h>
85ddaa7971fae2 Andy Shevchenko 2021-05-29  14  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 37843 bytes --]

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

end of thread, other threads:[~2021-08-03 21:51 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-29 11:19 [PATCH v2 01/13] leds: core: The -ENOTSUPP should never be seen by user space Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 02/13] leds: el15203000: Give better margin for usleep_range() Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 03/13] leds: el15203000: Correct headers (of*.h -> mod_devicetable.h) Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 04/13] leds: lgm-sso: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 05/13] leds: lgm-sso: Don't spam logs when probe is deferred Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 06/13] leds: lgm-sso: Remove explicit managed GPIO resource cleanup Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 07/13] leds: lgm-sso: Convert to use list_for_each_entry*() API Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 08/13] leds: lm3692x: Correct headers (of*.h -> mod_devicetable.h) Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 09/13] leds: lm3697: Update header block to reflect reality Andy Shevchenko
2021-08-03 21:47   ` Pavel Machek
2021-05-29 11:19 ` [PATCH v2 10/13] leds: lm3697: Make error handling more robust Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 11/13] leds: lt3593: Put fwnode in any case during ->probe() Andy Shevchenko
2021-05-29 11:19 ` [PATCH v2 12/13] leds: rt8515: " Andy Shevchenko
2021-06-01 10:06   ` Linus Walleij
2021-06-05  9:46     ` andy
2021-08-03 21:50       ` Pavel Machek
2021-08-03 21:51       ` Pavel Machek
2021-05-29 11:19 ` [PATCH v2 13/13] leds: sgm3140: " Andy Shevchenko
2021-06-23 13:15 ` [PATCH v2 01/13] leds: core: The -ENOTSUPP should never be seen by user space Andy Shevchenko
2021-07-13  7:34   ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2021-05-29 15:19 [PATCH v2 09/13] leds: lm3697: Update header block to reflect reality kernel test robot

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.