]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
usb: fsl-dt-fixup: Return an error code on error
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Thu, 25 Sep 2025 11:56:44 +0000 (12:56 +0100)
committerMarek Vasut <marek.vasut+usb@mailbox.org>
Tue, 28 Oct 2025 15:33:15 +0000 (16:33 +0100)
fsl_fdt_fixup_usb_erratum uses strcmp to detect an error but then
returns 'err' without it being set to an error. Calling code may not
detect that an error occurred leading to a silent failure. Instead just
return -EINVAL.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/usb/common/fsl-dt-fixup.c

index 6a68bd76c2742c89862c82a4106bf9b9c4db6c03..55176f7a87102ec5d8ecfb3070a0ce015e9df7a7 100644 (file)
@@ -99,7 +99,7 @@ static int fsl_fdt_fixup_usb_erratum(void *blob, const char *prop_erratum,
        else
                node_name = node_type;
        if (strcmp(node_name, controller_type))
-               return err;
+               return -EINVAL;
 
        err = fdt_setprop(blob, node_offset, prop_erratum, NULL, 0);
        if (err < 0) {