All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <linux_oss@crudebyte.com>
To: ericvh@kernel.org, lucho@ionkov.net, asmadeus@codewreck.org,
	m.grzeschik@pengutronix.de, yuehaibing@huawei.com,
	gregkh@linuxfoundation.org, Yue Haibing <yuehaibing@huawei.com>
Cc: v9fs@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 9p/trans_usbg: Fix incorrect error check in usb9pfs_alloc_instance()
Date: Sat, 19 Oct 2024 13:58:37 +0200	[thread overview]
Message-ID: <1854979.Kn10jCkGcg@silver> (raw)
In-Reply-To: <20241019092302.212221-1-yuehaibing@huawei.com>

On Saturday, October 19, 2024 11:23:02 AM CEST Yue Haibing wrote:
> kzalloc() should use NULL check not a IS_ERR() check.
> 
> Fixes: a3be076dc174 ("net/9p/usbg: Add new usb gadget function transport")
> Signed-off-by: Yue Haibing <yuehaibing@huawei.com>

Reviewed-by: Christian Schoenebeck <linux_oss@crudebyte.com>

> ---
>  net/9p/trans_usbg.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/9p/trans_usbg.c b/net/9p/trans_usbg.c
> index 975b76839dca..6b694f117aef 100644
> --- a/net/9p/trans_usbg.c
> +++ b/net/9p/trans_usbg.c
> @@ -909,9 +909,9 @@ static struct usb_function_instance *usb9pfs_alloc_instance(void)
>  	usb9pfs_opts->buflen = DEFAULT_BUFLEN;
>  
>  	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> -	if (IS_ERR(dev)) {
> +	if (!dev) {
>  		kfree(usb9pfs_opts);
> -		return ERR_CAST(dev);
> +		return ERR_PTR(-ENOMEM);
>  	}
>  
>  	usb9pfs_opts->dev = dev;
> 



      reply	other threads:[~2024-10-19 12:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-19  9:23 [PATCH] 9p/trans_usbg: Fix incorrect error check in usb9pfs_alloc_instance() Yue Haibing
2024-10-19 11:58 ` Christian Schoenebeck [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=1854979.Kn10jCkGcg@silver \
    --to=linux_oss@crudebyte.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=m.grzeschik@pengutronix.de \
    --cc=v9fs@lists.linux.dev \
    --cc=yuehaibing@huawei.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 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.