]> www.infradead.org Git - users/willy/xarray.git/commitdiff
usb: typec: thunderbolt: Remove IS_ERR check for plug
authorBenson Leung <bleung@chromium.org>
Fri, 24 Jan 2025 19:40:38 +0000 (19:40 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 3 Feb 2025 15:30:51 +0000 (16:30 +0100)
Fixes these Smatch static checker warnings:
drivers/usb/typec/altmodes/thunderbolt.c:354 tbt_ready() warn: 'plug' is not an error pointer

Fixes: 100e25738659 ("usb: typec: Add driver for Thunderbolt 3 Alternate Mode")
Signed-off-by: Benson Leung <bleung@chromium.org>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/Z5PstnlA52Z1F2SU@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/altmodes/thunderbolt.c

index 94e47d30e5989a085749845007dea16e147dcdb4..6eadf7835f8f6c8bc34c16a3c66dc3f6a42aac5b 100644 (file)
@@ -351,10 +351,10 @@ static bool tbt_ready(struct typec_altmode *alt)
         */
        for (int i = 0; i < TYPEC_PLUG_SOP_PP + 1; i++) {
                plug = typec_altmode_get_plug(tbt->alt, i);
-               if (IS_ERR(plug))
+               if (!plug)
                        continue;
 
-               if (!plug || plug->svid != USB_TYPEC_TBT_SID)
+               if (plug->svid != USB_TYPEC_TBT_SID)
                        break;
 
                plug->desc = "Thunderbolt3";