From: Cristian Marussi <cristian.marussi@arm.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-pm@vger.kernel.org
Subject: Re: [bug report] powercap: arm_scmi: Add SCMI powercap based driver
Date: Wed, 6 Jul 2022 15:49:46 +0100 [thread overview]
Message-ID: <YsWg/AA4oGL2917h@e120937-lin> (raw)
In-Reply-To: <YsWXievahG19PODw@kili>
On Wed, Jul 06, 2022 at 05:09:13PM +0300, Dan Carpenter wrote:
> Hello Cristian Marussi,
>
Hi Dan Carpenter,
> The patch 31afdd34f2b9: "powercap: arm_scmi: Add SCMI powercap based
> driver" from Jul 4, 2022, leads to the following Smatch static
> checker warning:
>
> drivers/powercap/arm_scmi_powercap.c:214 scmi_powercap_get_max_power_uw()
> warn: cast after binop
>
> drivers/powercap/arm_scmi_powercap.c
> 203 static int scmi_powercap_get_max_power_uw(struct powercap_zone *pz, int cid,
> 204 u64 *max_power_uw)
> 205 {
> 206 struct scmi_powercap_zone *spz = to_scmi_powercap_zone(pz);
> 207
> 208 if (!spz->info)
> 209 return -ENODEV;
> 210
> 211 if (spz->info->powercap_scale_uw)
> 212 *max_power_uw = (u64)spz->info->max_power_cap;
> 213 else
> 214 *max_power_uw = (u64)(spz->info->max_power_cap * 1000);
>
> What's the deal with this cast? It would make more sense to do the cast
> before the * 1000 so that it doesn't overflow the 32 bits. Is the cast
> even required though? The cast on the line before is decorative so
> maybe it's not required.
>
Yes indeed, I suspect it's a leftover from a previous implementation I
did. There are also other unneeded u64 casts indeed.
In fact this driver was NOT pulled with the last SCMI v3.1 updates/fixes given
the very scarce review it got upstream (as you can see...)
I'll review all of these and integrate your other fixes in my next post
of the SCMI Arm poercap driver.
Thanks,
Cristian
prev parent reply other threads:[~2022-07-06 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-06 14:09 [bug report] powercap: arm_scmi: Add SCMI powercap based driver Dan Carpenter
2022-07-06 14:49 ` Cristian Marussi [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=YsWg/AA4oGL2917h@e120937-lin \
--to=cristian.marussi@arm.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-pm@vger.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