From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795909831; b=HKl9k58n7cxOkgSICY9Byasy7Sy6isXZzFoXjwaacsdzLvsl6pJEHmGfr6YWI8Iz8FNn jFyeDuXlXrWz/SPj9/Hxedjtb3/IbAiE2q0tZButyfRmM90nBWBfLV3uJQIg0RlUJwVVK 7BlQJXX6iUzzl9+oEKk0H1ZkXZJEksnzVcBoCeSy1c/XR1qtpk0ZLImDuFsVRblDUi1OC EiU3XP3/hCEj+JwAp5mWXoxyFeogEVlb99e+PGiFveqI31G/QJUlXa977JC/2y/Ar5GXI ktuVKQ5s5En8t10+WAikSY49IbWiiIcrk0usx7UGRrpM/vclM3M9l+6xOKkFIlMwumA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795909831; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=vPztvtew4kqBvqbELczZeNC1ySkmbWm0/NOEK1DwwNQ=; b=ywScdJOHvsk6Z9tJBAsfdzK4Dekdjg+XnZZRrEQVq9lKFwRDzUZoDSKeT+5vbH/vPbFr Q28MebPwhy1iQ1taZ1bqrmcnpNXF9Syq9qqzFJtIRWhSh9QhXz7CW8EcEBVW0rrq2n0Lv +8SzAMroqwv0khCqwrhh9f8n5NK825eYtREnLHFzu7zI8riiCsAja3gFgBTk9W5oH0mfl /CuOTCX8jL7z8DwRVmB15PY02tE+y0hQ937hIYVTvDDjSCS5+z/TOzxUSfDKCOr2UEz+J +s3Zls87v93Z1myIic7TUfuKk90UN4CA4pJcW3+Cb/2+y3JIfbVocz6aM4QDIi3mggQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LETKxTSQ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A356F606A31C for ; Sat, 28 Nov 2026 23:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LETKxTSQ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2212D1F00898; Sat, 28 Nov 2026 23:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795909831; bh=vPztvtew4kqBvqbELczZeNC1ySkmbWm0/NOEK1DwwNQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=LETKxTSQagtGnBYJrbOHuL3PLOtWoCxU79/Uu/5+FufqFwEELQ8eL/zpC8A57loZ2 mKtVCV4dcM3dRrZaTP0jdhW4AkPPlN9oPeDT/Wk9dG4OboJNCF0Lv2qpK6FaYhtjw7 MMlgV6YE99YMlsHe71T1kYaDr9sMV2HZtC71EO9YRhQYlmnwbM25ZWegreb9bxkyGP 5CzOcnboJAxtpdvUiBtN8yEL9PZ1Y1nB8b4BVx4mzI5QkWdik9G2E+OSeeFR9zHWzz Esl7eOSDqNhPVNhp3h9cd7kXURvWLeNIbeh2jerR8OQdPTx9KSEXGw5gbvwnStAp1S mf0PYi73Y1jaQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3] leds: pca9532: Propagate I2C errors Reply-To: sashiko-reviews@lists.linux.dev To: "Daniil Demakov" Cc: linux-leds@vger.kernel.org, lee@kernel.org In-Reply-To: <20261128234104.242580-1-t3127430@gmail.com> References: <20261128234104.242580-1-t3127430@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 28 Nov 2026 23:50:29 +0000 X-Mailing-List: linux-leds@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] leds: pca9532: unrestored led->state on error in pca9532_set_blink() - [Low] leds: pca9532: redundant I2C write on rollback in pca9532_configure() -- commit 15d258237fb566c3dd867ed6f88e5dd7743fd211 Author: Daniil Demakov leds: pca9532: Propagate I2C errors This commit checks SMBus read and write return values in pca9532_setled(), propagates errors to callers, and unregisters the LED class device if configuring it fails. > diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c > index c8085427696ff..e2772c7b23d92 100644 > --- a/drivers/leds/leds-pca9532.c > +++ b/drivers/leds/leds-pca9532.c [ ... ] > @@ -257,9 +277,9 @@ static int pca9532_set_blink(struct led_classdev *led= _cdev, > if (err) > return err; > =20 > - pca9532_setled(led); > + err =3D pca9532_setled(led); > =20 > - return 0; > + return err; > } [Severity: Medium] Does returning an error here leave led->state stuck at PCA9532_PWM1? pca9532_update_hw_blink() sets led->state =3D PCA9532_PWM1 before pca9532_setled() writes the hardware selector register. When pca9532_set_blink() returns a non-zero error, led_blink_setup() falls back to software blinking, but non-zero brightness updates are then ignored because pca9532_set_brightness() sees PCA9532_PWM1: drivers/leds/leds-pca9532.c:pca9532_set_brightness() { ... if (value =3D=3D LED_OFF) { led->state =3D PCA9532_OFF; } else if (led->state =3D=3D PCA9532_PWM1) { return 0; /* Non-zero brightness shall not stop HW blinking */ ... } As a result, the ON phase of software blinking and later non-zero brightness writes silently do nothing, and pca9532_update_hw_blink() on sibling LEDs rejects different blink timings with -EINVAL even though hardware blinking was not enabled on this LED. pca9532_set_brightness() similarly updates led->state before pca9532_calcpwm() and pca9532_setled() succeed. [ ... ] > @@ -442,14 +460,20 @@ static int pca9532_configure(struct i2c_client *cli= ent, > led->name); > goto exit; > } > - pca9532_setled(led); > + err =3D pca9532_setled(led); > + if (err) { > + led_classdev_unregister(&led->ldev); > + goto exit; > + } > break; > case PCA9532_TYPE_N2100_BEEP: > /* PWM1 is reserved for beeper so blink will not use hardware */ > data->hw_blink =3D false; > BUG_ON(data->idev); > led->state =3D PCA9532_PWM1; > - pca9532_setled(led); > + err =3D pca9532_setled(led); > + if (err) > + goto exit; > data->idev =3D devm_input_allocate_device(&client->dev); > if (data->idev =3D=3D NULL) { > err =3D -ENOMEM; [Severity: Low] Could pca9532_setled() be called before led_classdev_register() in the PCA9532_TYPE_LED case, matching PCA9532_TYPE_N2100_BEEP below? When pca9532_setled() fails after registration, led_classdev_unregister() calls led_set_brightness(led_cdev, LED_OFF) and flushes set_brightness_work, which invokes pca9532_set_brightness() -> pca9532_setled() a second time against the failing I2C device. Also, both new "goto exit;" lines are indented with spaces instead of a tab. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261128234104.2425= 80-1-t3127430@gmail.com?part=3D1