From: Dan Carpenter <dan.carpenter@linaro.org>
To: luyulin@eswincomputing.com
Cc: linux-gpio@vger.kernel.org
Subject: Re: Re: [bug report] pinctrl: eswin: Add EIC7700 pinctrl driver
Date: Tue, 2 Sep 2025 11:00:44 +0300 [thread overview]
Message-ID: <aLakLIx5ZMgMTR6e@stanley.mountain> (raw)
In-Reply-To: <3eec843c.ae8.199095d1d4c.Coremail.luyulin@eswincomputing.com>
On Tue, Sep 02, 2025 at 03:38:41PM +0800, luyulin@eswincomputing.com wrote:
> Hi, Dan
>
> Thank you very much for your suggestions and reply.
> I changed IS_ERR_OR_NULL to IS_ERR and added select REGULATOR
> and REGULATOR_FIXED_VOLTAGE in Kconfig. The local tests are normal.
> I also added "Suggested-by: Dan Carpenter dan.carpenter@linaro.org" in the commit.
> Do you think this is acceptable?
>
> The commit content is as follows:
>
> From 4bf1f20bafc8dcfaebd43e7c8b42820edb36f028 Mon Sep 17 00:00:00 2001
> From: Yulin Lu <luyulin@eswincomputing.com>
> Date: Tue, 2 Sep 2025 14:41:53 +0800
> Subject: [PATCH] pinctrl: eswin: Fix regulator error check and Kconfig
> dependency
>
> 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@linaro.org>
> Fixes: 5b797bcc00ef ("pinctrl: eswin: Add EIC7700 pinctrl driver")
> Signed-off-by: Yulin Lu <luyulin@eswincomputing.com>
>
Sounds good to me. I'm not a Kconfig expert so I never know if a select
or a depend is more appropriate...
regards,
dan carpenter
prev parent reply other threads:[~2025-09-02 8:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 9:40 [bug report] pinctrl: eswin: Add EIC7700 pinctrl driver Dan Carpenter
2025-09-01 7:34 ` luyulin
2025-09-01 9:07 ` Dan Carpenter
2025-09-02 7:38 ` luyulin
2025-09-02 8:00 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aLakLIx5ZMgMTR6e@stanley.mountain \
--to=dan.carpenter@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=luyulin@eswincomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).