Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1132801pxj; Sat, 29 May 2021 04:20:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeeT5MWwJq/paal0kVgDwwQA2sXsrEVzrtCBsuFoUcMiAyJDSbnuMGEC/aNd1qVG5svRRa X-Received: by 2002:a05:6638:2181:: with SMTP id s1mr12538775jaj.66.1622287244291; Sat, 29 May 2021 04:20:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622287244; cv=none; d=google.com; s=arc-20160816; b=LMXbvwYE+M7UxrjX58bRONDSGtjwyh6MjPQgklEil63psEH9H4SmKDKBVdUGuvjPj3 56sAswOZl/JHkDgYpY1lV0viqseSkKxcoSZ3m4aLpz3CCmvM1QoNVhplTKMRB/x2zrb9 AiHbsE5QzqkC6TQ/lXh3Cy5SOBcc01jGt+bpFgDf0eBiEvchCKJhiMKyoAloUl5MzL49 61q3oecA8mJlH3NPRytJtvZcNVLjWG52VEKqceSMerfwZQNa7BiBS+E+6JrBVuWII9Bb t+QKtNUJ+cSfMagPgob+j9Uiixrf3/dw3dgR8EB03v3l8jTOpnBfIV67lXZ8ZIHn8hTK H2zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=VvyNHklNpoFiVzTagnb322bsOfBQZYlFOrKS5RSSlgw=; b=bekGp+i80YniOWuy32WPNpPn+0jKvPlpkxaqK7G0oDYCY4FQcg+bFU+F0xAlj1sIQB xRm0juMqv9T6nIpb0deU/3UmOPwPXdrL+bry2T5oDE+fyKIxOpCA1f9DSgedP7RzQaKi fONsLHOzjaR+4Pf4cV8E4dmKd4Tw/nq7S2m7/BQnI9kxkDvfzUdCwnSglmN5oln5Ligb ptgkrykfEHFrAOr/Wxr/R/+llCq7yurtN18y67JzmbZ8lOsV9mMbQ9vpGpjiOyObiTGa RL7iGq1N7C3l02tyYM/H1TNiVLnab7mJuvKKQo4qhUIEIR/m59TZKXIEJZE0wn2ZgXK8 NC1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k21si8943178jad.9.2021.05.29.04.20.22; Sat, 29 May 2021 04:20:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229652AbhE2LVQ (ORCPT + 99 others); Sat, 29 May 2021 07:21:16 -0400 Received: from fgw21-7.mail.saunalahti.fi ([62.142.5.82]:38750 "EHLO fgw21-7.mail.saunalahti.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbhE2LVP (ORCPT ); Sat, 29 May 2021 07:21:15 -0400 Received: from localhost (88-115-248-186.elisa-laajakaista.fi [88.115.248.186]) by fgw21.mail.saunalahti.fi (Halon) with ESMTP id c0719dcb-c06f-11eb-9eb8-005056bdd08f; Sat, 29 May 2021 14:19:37 +0300 (EEST) From: Andy Shevchenko To: Pavel Machek , Andy Shevchenko , Amireddy Mallikarjuna reddy , Linus Walleij , Abanoub Sameh , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Krzysztof Kozlowski , linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jacek Anaszewski Subject: [PATCH v2 01/13] leds: core: The -ENOTSUPP should never be seen by user space Date: Sat, 29 May 2021 14:19:23 +0300 Message-Id: <20210529111935.3849707-1-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Andy Shevchenko --- 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