public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Pengyu Luo <mitltlatltl@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: huawei_gaokun: add error checking
Date: Thu, 17 Apr 2025 16:36:58 +0300	[thread overview]
Message-ID: <aAED-hlyVvbSXoJn@kuha.fi.intel.com> (raw)
In-Reply-To: <20250415172006.126740-1-mitltlatltl@gmail.com>

On Wed, Apr 16, 2025 at 01:20:05AM +0800, Pengyu Luo wrote:
> 'cci' may be uninitialized, adding error checking to fix it.
> 
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/all/Z_44zoTyLLdXNkKT@stanley.mountain
> Fixes: 00327d7f2c8c ("usb: typec: ucsi: add Huawei Matebook E Go ucsi driver")
> Signed-off-by: Pengyu Luo <mitltlatltl@gmail.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
> index 344aa7aeaf..7b5222081b 100644
> --- a/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
> +++ b/drivers/usb/typec/ucsi/ucsi_huawei_gaokun.c
> @@ -359,6 +359,7 @@ static int gaokun_ucsi_notify(struct notifier_block *nb,
>  			      unsigned long action, void *data)
>  {
>  	u32 cci;
> +	int ret;
>  	struct gaokun_ucsi *uec = container_of(nb, struct gaokun_ucsi, nb);
>  
>  	switch (action) {
> @@ -368,7 +369,10 @@ static int gaokun_ucsi_notify(struct notifier_block *nb,
>  		return NOTIFY_OK;
>  
>  	case EC_EVENT_UCSI:
> -		gaokun_ucsi_read_cci(uec->ucsi, &cci);
> +		ret = gaokun_ucsi_read_cci(uec->ucsi, &cci);
> +		if (ret)
> +			return NOTIFY_DONE;
> +
>  		ucsi_notify_common(uec->ucsi, cci);
>  		if (UCSI_CCI_CONNECTOR(cci))
>  			gaokun_ucsi_handle_no_usb_event(uec, UCSI_CCI_CONNECTOR(cci) - 1);
> -- 
> 2.49.0

-- 
heikki

      reply	other threads:[~2025-04-17 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 17:20 [PATCH] usb: typec: ucsi: huawei_gaokun: add error checking Pengyu Luo
2025-04-17 13:36 ` Heikki Krogerus [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=aAED-hlyVvbSXoJn@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mitltlatltl@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox