Message ID | 1649843891-15554-2-git-send-email-quic_linyyuan@quicinc.com |
---|---|
State | Superseded |
Headers | show |
Series | usb: typec: ucsi: allow retry to find role switch | expand |
On Wed, Apr 13, 2022 at 05:58:08PM +0800, Linyu Yuan wrote: > As con->port will be used in error path of ucsi_init(), > it should be NULL or valid. > > Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> > --- > v2: no change > v3: no change > > drivers/usb/typec/ucsi/ucsi.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > index f0c2fa1..77ac0b7 100644 > --- a/drivers/usb/typec/ucsi/ucsi.c > +++ b/drivers/usb/typec/ucsi/ucsi.c > @@ -1100,6 +1100,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) > con->port = typec_register_port(ucsi->dev, cap); > if (IS_ERR(con->port)) { > ret = PTR_ERR(con->port); > + con->port = NULL; > goto out; > } Please merge this into the next patch. thanks,
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com> > Sent: Wednesday, April 13, 2022 7:32 PM > To: Linyu Yuan (QUIC) <quic_linyyuan@quicinc.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux- > usb@vger.kernel.org; Jack Pham (QUIC) <quic_jackp@quicinc.com> > Subject: Re: [PATCH v3 1/4] usb: typec: ucsi: set con->port to NULL when > register port fail > > On Wed, Apr 13, 2022 at 05:58:08PM +0800, Linyu Yuan wrote: > > As con->port will be used in error path of ucsi_init(), > > it should be NULL or valid. > > > > Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> > > --- > > v2: no change > > v3: no change > > > > drivers/usb/typec/ucsi/ucsi.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c > > index f0c2fa1..77ac0b7 100644 > > --- a/drivers/usb/typec/ucsi/ucsi.c > > +++ b/drivers/usb/typec/ucsi/ucsi.c > > @@ -1100,6 +1100,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int > index) > > con->port = typec_register_port(ucsi->dev, cap); > > if (IS_ERR(con->port)) { > > ret = PTR_ERR(con->port); > > + con->port = NULL; > > goto out; > > } > > Please merge this into the next patch. Sure, will do after all discussion are done. > > thanks, > > -- > heikki
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index f0c2fa1..77ac0b7 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -1100,6 +1100,7 @@ static int ucsi_register_port(struct ucsi *ucsi, int index) con->port = typec_register_port(ucsi->dev, cap); if (IS_ERR(con->port)) { ret = PTR_ERR(con->port); + con->port = NULL; goto out; }
As con->port will be used in error path of ucsi_init(), it should be NULL or valid. Signed-off-by: Linyu Yuan <quic_linyyuan@quicinc.com> --- v2: no change v3: no change drivers/usb/typec/ucsi/ucsi.c | 1 + 1 file changed, 1 insertion(+)