[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACRpkdYSOGkeN34tzLtKMASS9gskNzsVGP=7_08CQvT-O6dobg@mail.gmail.com>
Date: Thu, 4 Sep 2025 21:29:39 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Yulin Lu <luyulin@...incomputing.com>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
ningyu@...incomputing.com, zhengyu@...incomputing.com,
linmin@...incomputing.com, huangyifeng@...incomputing.com,
fenglin@...incomputing.com, lianghujun@...incomputing.com,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH v2] pinctrl: eswin: Fix regulator error check and Kconfig dependency
On Wed, Sep 3, 2025 at 11:19 AM Yulin Lu <luyulin@...incomputing.com> wrote:
> Smatch reported the following warning in eic7700_pinctrl_probe():
>
> drivers/pinctrl/pinctrl-eic7700.c:638 eic7700_pinctrl_probe()
> warn: passing zero to 'PTR_ERR'
>
> The root cause is that devm_regulator_get() may return NULL when
> CONFIG_REGULATOR is disabled. In such case, IS_ERR_OR_NULL() triggers
> PTR_ERR(NULL) which evaluates to 0, leading to passing a success code
> as an error.
>
> However, this driver cannot work without a regulator. To fix this:
>
> - Change the check from IS_ERR_OR_NULL() to IS_ERR()
> - Update Kconfig to explicitly select REGULATOR and
> REGULATOR_FIXED_VOLTAGE, ensuring that the regulator framework is
> always available.
>
> This resolves the Smatch warning and enforces the correct dependency.
>
> Suggested-by: Dan Carpenter <dan.carpenter@...aro.org>
> Fixes: 5b797bcc00ef ("pinctrl: eswin: Add EIC7700 pinctrl driver")
> Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
> Closes: https://lore.kernel.org/linux-gpio/aKRGiZ-fai0bv0tG@stanley.mountain/
> Signed-off-by: Yulin Lu <luyulin@...incomputing.com>
Patch applied!
Yours,
Linus Walleij
Powered by blists - more mailing lists