From: Dan Carpenter <error27@gmail.com>
To: Sudeep Holla <sudeep.holla@kernel.org>
Cc: linux-pm@vger.kernel.org
Subject: [bug report] firmware: scpi: add device power domain support using genpd
Date: Thu, 21 May 2026 11:32:13 +0300 [thread overview]
Message-ID: <ag7DDZf3TFZy_o3e@stanley.mountain> (raw)
Hello Sudeep Holla,
Commit 8bec4337ad40 ("firmware: scpi: add device power domain support
using genpd") from Jun 2, 2016 (linux-next), leads to the following
Smatch static checker warning:
drivers/pmdomain/marvell/pxa1908-power-controller.c:231 pxa1908_pd_init()
warn: passing positive error code '1' to 'dev_err_probe'
drivers/pmdomain/marvell/pxa1908-power-controller.c
216 static int
217 pxa1908_pd_init(struct pxa1908_pd_ctrl *ctrl, int id, struct device *dev)
218 {
219 struct pxa1908_pd *pd = &domains[id];
220 int ret;
221
222 ctrl->domains[id] = &pd->genpd;
223
224 pd->ctrl = ctrl;
225
226 /* Make sure the state of the hardware is synced with the domain table above. */
227 if (pd->data.keep_on) {
228 ret = pd->genpd.power_on(&pd->genpd);
229 if (ret)
230 return dev_err_probe(dev, ret, "failed to power on domain '%s'\n",
--> 231 pd->genpd.name);
232 } else {
The problem is that genpd.power_on() functions are supposed to return
0 on success or negative error codes.
drivers/pmdomain/arm/scpi_pm_domain.c
34 static int scpi_pd_power(struct scpi_pm_domain *pd, bool power_on)
35 {
36 int ret;
37 enum scpi_power_domain_state state;
38
39 if (power_on)
40 state = SCPI_PD_STATE_ON;
41 else
42 state = SCPI_PD_STATE_OFF;
43
44 ret = pd->ops->device_set_power_state(pd->domain, state);
45 if (ret)
46 return ret;
^^^^^^^^^^^
Negatives. Good.
47
48 return !(state == pd->ops->device_get_power_state(pd->domain));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
But this returns 0/1.
49 }
50
51 static int scpi_pd_power_on(struct generic_pm_domain *domain)
52 {
53 struct scpi_pm_domain *pd = to_scpi_pd(domain);
54
55 return scpi_pd_power(pd, true);
56 }
57
58 static int scpi_pd_power_off(struct generic_pm_domain *domain)
59 {
60 struct scpi_pm_domain *pd = to_scpi_pd(domain);
61
62 return scpi_pd_power(pd, false);
63 }
This email is a free service from the Smatch-CI project [smatch.sf.net].
regards,
dan carpenter
reply other threads:[~2026-05-21 8:32 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=ag7DDZf3TFZy_o3e@stanley.mountain \
--to=error27@gmail.com \
--cc=linux-pm@vger.kernel.org \
--cc=sudeep.holla@kernel.org \
/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