From: Zwane Mwaikambo <zwane@yosper.io>
To: unlisted-recipients:; (no To-header on input)
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix USB Type C hub crash in typec_altmode_update_active
Date: Sat, 25 Jul 2020 23:42:31 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.21.2007252334190.11533@montezuma.home> (raw)
In-Reply-To: <alpine.DEB.2.21.2007252222310.11533@montezuma.home>
On Sat, 25 Jul 2020, Zwane Mwaikambo wrote:
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index d0c63afaf..30d0857e4 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -218,9 +218,12 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
> if (cur < UCSI_MAX_ALTMODES)
> altmode = typec_altmode_get_partner(con->port_altmode[cur]);
>
> - for (i = 0; con->partner_altmode[i]; i++)
> - typec_altmode_update_active(con->partner_altmode[i],
> - con->partner_altmode[i] == altmode);
> + for (i = 0; i < UCSI_MAX_ALTMODES; i++) {
> + if (con->partner_altmode[i]) {
> + typec_altmode_update_active(con->partner_altmode[i],
> + con->partner_altmode[i] == altmode);
> + }
> + }
> }
>
> static u8 ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
>
Previous patch had whitespace issues and i cleaned it up for coding style
reasons, patch is against 5.8.0-rc6
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index d0c63afaf..30e811fde 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -218,9 +218,10 @@ void ucsi_altmode_update_active(struct ucsi_connector *con)
if (cur < UCSI_MAX_ALTMODES)
altmode = typec_altmode_get_partner(con->port_altmode[cur]);
- for (i = 0; con->partner_altmode[i]; i++)
- typec_altmode_update_active(con->partner_altmode[i],
- con->partner_altmode[i] == altmode);
+ for (i = 0; i < UCSI_MAX_ALTMODES; i++)
+ if (con->partner_altmode[i])
+ typec_altmode_update_active(con->partner_altmode[i],
+ con->partner_altmode[i] == altmode);
}
static u8 ucsi_altmode_next_mode(struct typec_altmode **alt, u16 svid)
prev parent reply other threads:[~2020-07-26 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-26 5:52 [PATCH] Fix USB Type C hub crash in typec_altmode_update_active Zwane Mwaikambo
2020-07-26 6:42 ` Zwane Mwaikambo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.21.2007252334190.11533@montezuma.home \
--to=zwane@yosper.io \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.