linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool
@ 2021-10-11  9:20 Dan Carpenter
  2021-10-11 18:40 ` Guru Das Srinagesh
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2021-10-11  9:20 UTC (permalink / raw)
  To: swboyd; +Cc: linux-arm-msm

Hello Stephen Boyd,

The patch 9d11af8b06a8: "firmware: qcom_scm: Make
__qcom_scm_is_call_available() return bool" from Feb 23, 2021, leads
to the following Smatch static checker warning:

	drivers/firmware/qcom_scm.c:255 __qcom_scm_is_call_available()
	warn: signedness bug returning '(-22)'

drivers/firmware/qcom_scm.c
    232 static bool __qcom_scm_is_call_available(struct device *dev, u32 svc_id,
    233                                          u32 cmd_id)
    234 {
    235         int ret;
    236         struct qcom_scm_desc desc = {
    237                 .svc = QCOM_SCM_SVC_INFO,
    238                 .cmd = QCOM_SCM_INFO_IS_CALL_AVAIL,
    239                 .owner = ARM_SMCCC_OWNER_SIP,
    240         };
    241         struct qcom_scm_res res;
    242 
    243         desc.arginfo = QCOM_SCM_ARGS(1);
    244         switch (__get_convention()) {
    245         case SMC_CONVENTION_ARM_32:
    246         case SMC_CONVENTION_ARM_64:
    247                 desc.args[0] = SCM_SMC_FNID(svc_id, cmd_id) |
    248                                 (ARM_SMCCC_OWNER_SIP << ARM_SMCCC_OWNER_SHIFT);
    249                 break;
    250         case SMC_CONVENTION_LEGACY:
    251                 desc.args[0] = SCM_LEGACY_FNID(svc_id, cmd_id);
    252                 break;
    253         default:
    254                 pr_err("Unknown SMC convention being used\n");
--> 255                 return -EINVAL;

Presumably this should be "return false;"?

    256         }
    257 
    258         ret = qcom_scm_call(dev, &desc, &res);
    259 
    260         return ret ? false : !!res.result[0];
    261 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-10-11 20:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  9:20 [bug report] firmware: qcom_scm: Make __qcom_scm_is_call_available() return bool Dan Carpenter
2021-10-11 18:40 ` Guru Das Srinagesh
2021-10-11 19:06   ` Stephen Boyd
2021-10-11 20:10     ` Guru Das Srinagesh

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).