ti_sci: Provide error code on error exit
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Wed, 8 Oct 2025 09:23:36 +0000 (10:23 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 16 Oct 2025 21:02:14 +0000 (15:02 -0600)
In ti_sci_get_response the check for message sequence will return ret
on a fail but ret will be 0 at that point. Instead return -EINVAL.
Also change dev_dbg call to dev_err to be consistent with other error
detection code in the same function.

This issue was found by Smatch.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Nishanth Menon <nm@ti.com>
Tested-by: Anshul Dalal <anshuld@ti.com>
drivers/firmware/ti_sci.c

index 2042d88..534326b 100644 (file)
@@ -191,9 +191,9 @@ static int ti_sci_get_response(struct ti_sci_info *info,
 
        /* Sanity check for message response */
        if (hdr->seq != info->seq) {
-               dev_dbg(info->dev, "%s: Message for %d is not expected\n",
+               dev_err(info->dev, "%s: Message for %d is not expected\n",
                        __func__, hdr->seq);
-               return ret;
+               return -EINVAL;
        }
 
        if (msg->len > info->desc->max_msg_size) {