public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Li Zhengyu <lizhengyu3@huawei.com>
Cc: dbaryshkov@gmail.com, stern@rowland.harvard.edu,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable
Date: Thu, 19 May 2022 17:55:39 +0200	[thread overview]
Message-ID: <YoZoe3iOJDbd6SJ9@kroah.com> (raw)
In-Reply-To: <20220519020434.31575-1-lizhengyu3@huawei.com>

On Thu, May 19, 2022 at 10:04:34AM +0800, Li Zhengyu wrote:
> The return value of device_wakeup_enable() is unchecked, as the result
> usb_remove_hcd() is unreachable even if device_wakeup_enable() is failed.
> 
> Fixes: 78c73414f4f6 ("USB: ohci: add support for tmio-ohci cell")
> 
> Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com>
> ---
>  drivers/usb/host/ohci-tmio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
> index 49539b9f0e94..8148dc90c066 100644
> --- a/drivers/usb/host/ohci-tmio.c
> +++ b/drivers/usb/host/ohci-tmio.c
> @@ -244,7 +244,7 @@ static int ohci_hcd_tmio_drv_probe(struct platform_device *dev)
>  	if (ret)
>  		goto err_add_hcd;
>  
> -	device_wakeup_enable(hcd->self.controller);
> +	ret = device_wakeup_enable(hcd->self.controller);
>  	if (ret == 0)
>  		return ret;

But now if there is an error you do not clean up properly, so you have
memory leaks?

How did you test this?

thanks,

greg k-h

  reply	other threads:[~2022-05-19 15:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-19  2:04 [PATCH -next] usb: host: ohci-tmio: Fix unchecked return value for device_wakeup_enable Li Zhengyu
2022-05-19 15:55 ` Greg KH [this message]
2022-05-20  1:39   ` lizhengyu (E)

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=YoZoe3iOJDbd6SJ9@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=dbaryshkov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lizhengyu3@huawei.com \
    --cc=stern@rowland.harvard.edu \
    /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