Skip to content

Commit

Permalink
usb: typec: thunderbolt: Remove IS_ERR check for plug
Browse files Browse the repository at this point in the history
[ Upstream commit 9682c35 ]

Fixes these Smatch static checker warnings:
drivers/usb/typec/altmodes/thunderbolt.c:354 tbt_ready() warn: 'plug' is not an error pointer

Fixes: 100e257 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Benson Leung authored and Greg Kroah-Hartman committed Apr 10, 2025
1 parent dd67fdb commit 46efdf8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/typec/altmodes/thunderbolt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 46efdf8

Please sign in to comment.