From: Greg KH <gregkh@linuxfoundation.org>
To: YueHaibing <yuehaibing@huawei.com>
Cc: balbi@kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] USB: gadget: f_fs: Use ERR_CAST instead of ERR_PTR(PTR_ERR(...))
Date: Fri, 21 May 2021 13:48:44 +0200 [thread overview]
Message-ID: <YKeeHDy/VAhuoG6B@kroah.com> (raw)
In-Reply-To: <20210519023032.19812-1-yuehaibing@huawei.com>
On Wed, May 19, 2021 at 10:30:32AM +0800, YueHaibing wrote:
> A coccicheck run provided information like the following.
>
> ./drivers/usb/gadget/function/f_fs.c:3832:9-16:
> WARNING: ERR_CAST can be used with data
>
> Use ERR_CAST to fix this.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/usb/gadget/function/f_fs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
> index bf109191659a..61110ff52f49 100644
> --- a/drivers/usb/gadget/function/f_fs.c
> +++ b/drivers/usb/gadget/function/f_fs.c
> @@ -3829,7 +3829,7 @@ static char *ffs_prepare_buffer(const char __user *buf, size_t len)
>
> data = memdup_user(buf, len);
> if (IS_ERR(data))
> - return ERR_PTR(PTR_ERR(data));
> + return ERR_CAST(data);
This should just be:
return PTR_ERR(data);
right?
No need for 2 casts to happen here.
thanks,
greg k-h
next prev parent reply other threads:[~2021-05-21 11:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 2:30 [PATCH -next] USB: gadget: f_fs: Use ERR_CAST instead of ERR_PTR(PTR_ERR(...)) YueHaibing
2021-05-21 11:48 ` Greg KH [this message]
2021-05-23 6:33 ` YueHaibing
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=YKeeHDy/VAhuoG6B@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=balbi@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).