diff mbox series

[2/2] usb: typec: thunderbolt: Remove IS_ERR check for plug

Message ID Z5PstnlA52Z1F2SU@google.com (mailing list archive)
State Accepted
Commit 9682c35ff6ecd76d9462d4749b8b413d3e8e605e
Headers show
Series [1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP | expand

Commit Message

Benson Leung Jan. 24, 2025, 7:40 p.m. UTC
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>
---
 drivers/usb/typec/altmodes/thunderbolt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Heikki Krogerus Jan. 28, 2025, 8:16 a.m. UTC | #1
On Fri, Jan 24, 2025 at 07:40:38PM +0000, Benson Leung wrote:
> 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>

> ---
>  drivers/usb/typec/altmodes/thunderbolt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/altmodes/thunderbolt.c
> index 94e47d30e598..6eadf7835f8f 100644
> --- a/drivers/usb/typec/altmodes/thunderbolt.c
> +++ b/drivers/usb/typec/altmodes/thunderbolt.c
> @@ -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";
> -- 
> 2.48.1.262.g85cc9f2d1e-goog
Greg Kroah-Hartman Feb. 3, 2025, 3:31 p.m. UTC | #2
On Fri, Jan 24, 2025 at 07:40:38PM +0000, Benson Leung wrote:
> 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>

Please do not put a blank line between "Fixes:" and your signed-off-by
line.

thanks,

greg k-h
diff mbox series

Patch

diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/altmodes/thunderbolt.c
index 94e47d30e598..6eadf7835f8f 100644
--- a/drivers/usb/typec/altmodes/thunderbolt.c
+++ b/drivers/usb/typec/altmodes/thunderbolt.c
@@ -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";