* [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP
@ 2025-01-24 19:40 Benson Leung
2025-01-28 8:17 ` Heikki Krogerus
2025-02-03 15:18 ` Greg KH
0 siblings, 2 replies; 4+ messages in thread
From: Benson Leung @ 2025-01-24 19:40 UTC (permalink / raw)
To: heikki.krogerus, gregkh, abhishekpandit, dan.carpenter
Cc: bleung, linux-usb, linux-kernel, akuchynski, ukaszb
Fixes these Smatch static checker warnings:
drivers/usb/typec/altmodes/thunderbolt.c:116 tbt_altmode_work() warn: why is zero skipped 'i'
drivers/usb/typec/altmodes/thunderbolt.c:147 tbt_enter_modes_ordered() warn: why is zero skipped 'i'
drivers/usb/typec/altmodes/thunderbolt.c:328 tbt_altmode_remove() warn: why is zero skipped 'i'
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 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/altmodes/thunderbolt.c
index 1b475b1d98e7..94e47d30e598 100644
--- a/drivers/usb/typec/altmodes/thunderbolt.c
+++ b/drivers/usb/typec/altmodes/thunderbolt.c
@@ -112,7 +112,7 @@ static void tbt_altmode_work(struct work_struct *work)
return;
disable_plugs:
- for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
+ for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
if (tbt->plug[i])
typec_altmode_put_plug(tbt->plug[i]);
@@ -143,7 +143,7 @@ static int tbt_enter_modes_ordered(struct typec_altmode *alt)
if (tbt->plug[TYPEC_PLUG_SOP_P]) {
ret = typec_cable_altmode_enter(alt, TYPEC_PLUG_SOP_P, NULL);
if (ret < 0) {
- for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
+ for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
if (tbt->plug[i])
typec_altmode_put_plug(tbt->plug[i]);
@@ -324,7 +324,7 @@ static void tbt_altmode_remove(struct typec_altmode *alt)
{
struct tbt_altmode *tbt = typec_altmode_get_drvdata(alt);
- for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
+ for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
if (tbt->plug[i])
typec_altmode_put_plug(tbt->plug[i]);
}
--
2.48.1.262.g85cc9f2d1e-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP
2025-01-24 19:40 [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP Benson Leung
@ 2025-01-28 8:17 ` Heikki Krogerus
2025-02-03 15:18 ` Greg KH
1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2025-01-28 8:17 UTC (permalink / raw)
To: Benson Leung
Cc: gregkh, abhishekpandit, dan.carpenter, linux-usb, linux-kernel,
akuchynski, ukaszb
On Fri, Jan 24, 2025 at 07:40:23PM +0000, Benson Leung wrote:
> Fixes these Smatch static checker warnings:
> drivers/usb/typec/altmodes/thunderbolt.c:116 tbt_altmode_work() warn: why is zero skipped 'i'
> drivers/usb/typec/altmodes/thunderbolt.c:147 tbt_enter_modes_ordered() warn: why is zero skipped 'i'
> drivers/usb/typec/altmodes/thunderbolt.c:328 tbt_altmode_remove() warn: why is zero skipped 'i'
>
> 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 | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/altmodes/thunderbolt.c b/drivers/usb/typec/altmodes/thunderbolt.c
> index 1b475b1d98e7..94e47d30e598 100644
> --- a/drivers/usb/typec/altmodes/thunderbolt.c
> +++ b/drivers/usb/typec/altmodes/thunderbolt.c
> @@ -112,7 +112,7 @@ static void tbt_altmode_work(struct work_struct *work)
> return;
>
> disable_plugs:
> - for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
> + for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
> if (tbt->plug[i])
> typec_altmode_put_plug(tbt->plug[i]);
>
> @@ -143,7 +143,7 @@ static int tbt_enter_modes_ordered(struct typec_altmode *alt)
> if (tbt->plug[TYPEC_PLUG_SOP_P]) {
> ret = typec_cable_altmode_enter(alt, TYPEC_PLUG_SOP_P, NULL);
> if (ret < 0) {
> - for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
> + for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
> if (tbt->plug[i])
> typec_altmode_put_plug(tbt->plug[i]);
>
> @@ -324,7 +324,7 @@ static void tbt_altmode_remove(struct typec_altmode *alt)
> {
> struct tbt_altmode *tbt = typec_altmode_get_drvdata(alt);
>
> - for (int i = TYPEC_PLUG_SOP_PP; i > 0; --i) {
> + for (int i = TYPEC_PLUG_SOP_PP; i >= 0; --i) {
> if (tbt->plug[i])
> typec_altmode_put_plug(tbt->plug[i]);
> }
> --
> 2.48.1.262.g85cc9f2d1e-goog
--
heikki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP
2025-01-24 19:40 [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP Benson Leung
2025-01-28 8:17 ` Heikki Krogerus
@ 2025-02-03 15:18 ` Greg KH
2025-02-03 16:53 ` Benson Leung
1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2025-02-03 15:18 UTC (permalink / raw)
To: Benson Leung
Cc: heikki.krogerus, abhishekpandit, dan.carpenter, linux-usb,
linux-kernel, akuchynski, ukaszb
On Fri, Jan 24, 2025 at 07:40:23PM +0000, Benson Leung wrote:
> Fixes these Smatch static checker warnings:
> drivers/usb/typec/altmodes/thunderbolt.c:116 tbt_altmode_work() warn: why is zero skipped 'i'
> drivers/usb/typec/altmodes/thunderbolt.c:147 tbt_enter_modes_ordered() warn: why is zero skipped 'i'
> drivers/usb/typec/altmodes/thunderbolt.c:328 tbt_altmode_remove() warn: why is zero skipped 'i'
>
> 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 | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Please always use 'git send-email' or if not, manually thread your
patches so they all show up together as a series. These are both
individual and as such, don't play nice with tools.
I'll try to manually handle them, but you owe me...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP
2025-02-03 15:18 ` Greg KH
@ 2025-02-03 16:53 ` Benson Leung
0 siblings, 0 replies; 4+ messages in thread
From: Benson Leung @ 2025-02-03 16:53 UTC (permalink / raw)
To: Greg KH
Cc: Benson Leung, heikki.krogerus, abhishekpandit, dan.carpenter,
linux-usb, linux-kernel, akuchynski, ukaszb
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
Hi Greg,
On Mon, Feb 03, 2025 at 04:18:28PM +0100, Greg KH wrote:
> On Fri, Jan 24, 2025 at 07:40:23PM +0000, Benson Leung wrote:
> > Fixes these Smatch static checker warnings:
> > drivers/usb/typec/altmodes/thunderbolt.c:116 tbt_altmode_work() warn: why is zero skipped 'i'
> > drivers/usb/typec/altmodes/thunderbolt.c:147 tbt_enter_modes_ordered() warn: why is zero skipped 'i'
> > drivers/usb/typec/altmodes/thunderbolt.c:328 tbt_altmode_remove() warn: why is zero skipped 'i'
> >
> > 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 | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
>
> Please always use 'git send-email' or if not, manually thread your
> patches so they all show up together as a series. These are both
> individual and as such, don't play nice with tools.
Sorry about that. I still need to set up my git-send-email workflow on this new
cloud workstation, and I'll get that rectified for next time.
>
> I'll try to manually handle them, but you owe me...
Thanks! I'll definitely owe you one.
>
> thanks,
>
> greg k-h
Benson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-03 16:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-24 19:40 [PATCH 1/2] usb: typec: thunderbolt: Fix loops that iterate TYPEC_PLUG_SOP_P and TYPEC_PLUG_SOP_PP Benson Leung
2025-01-28 8:17 ` Heikki Krogerus
2025-02-03 15:18 ` Greg KH
2025-02-03 16:53 ` Benson Leung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).