diff mbox series

firmware: arm_scmi: Do not use !! on boolean when setting msg->flags

Message ID 20230921085257.3125744-1-sudeep.holla@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_scmi: Do not use !! on boolean when setting msg->flags | expand

Commit Message

Sudeep Holla Sept. 21, 2023, 8:52 a.m. UTC
Both pc->async_powercap_cap_set and ignore_dresp are already boolean.
Use of !! on them is obviously dubious.

Sparse reports:
drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y
drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y

Remove the unnecessary !! and get rid of the warning.

Cc: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/powercap.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Cristian Marussi Sept. 27, 2023, 11 a.m. UTC | #1
On Thu, Sep 21, 2023 at 09:52:57AM +0100, Sudeep Holla wrote:
> Both pc->async_powercap_cap_set and ignore_dresp are already boolean.
> Use of !! on them is obviously dubious.
> 
> Sparse reports:
> drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y
> drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y
> 

Hi,

LGTM, indeed I was seeing that report too since a while, just I did not
realize why.

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian
Sudeep Holla Sept. 27, 2023, 1:12 p.m. UTC | #2
On Thu, 21 Sep 2023 09:52:57 +0100, Sudeep Holla wrote:
> Both pc->async_powercap_cap_set and ignore_dresp are already boolean.
> Use of !! on them is obviously dubious.
>
> Sparse reports:
> drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y
> drivers/firmware/arm_scmi/powercap.c:363:17: warning: dubious: x & !y
>
> [...]

Applied to sudeep.holla/linux (for-next/scmi/updates), thanks!

[1/1] firmware: arm_scmi: Do not use !! on boolean when setting msg->flags
      https://git.kernel.org/sudeep.holla/c/a10aa2584ef5
--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_scmi/powercap.c b/drivers/firmware/arm_scmi/powercap.c
index 244929cb4f3e..cb5617443a14 100644
--- a/drivers/firmware/arm_scmi/powercap.c
+++ b/drivers/firmware/arm_scmi/powercap.c
@@ -360,8 +360,8 @@  static int scmi_powercap_xfer_cap_set(const struct scmi_protocol_handle *ph,
 	msg = t->tx.buf;
 	msg->domain = cpu_to_le32(pc->id);
 	msg->flags =
-		cpu_to_le32(FIELD_PREP(CAP_SET_ASYNC, !!pc->async_powercap_cap_set) |
-			    FIELD_PREP(CAP_SET_IGNORE_DRESP, !!ignore_dresp));
+		cpu_to_le32(FIELD_PREP(CAP_SET_ASYNC, pc->async_powercap_cap_set) |
+			    FIELD_PREP(CAP_SET_IGNORE_DRESP, ignore_dresp));
 	msg->value = cpu_to_le32(power_cap);
 
 	if (!pc->async_powercap_cap_set || ignore_dresp) {