All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] USB: gadget: f_fs: Remove unneed cast in ffs_prepare_buffer()
@ 2021-05-29 12:04 YueHaibing
  2021-05-29 12:11 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: YueHaibing @ 2021-05-29 12:04 UTC (permalink / raw)
  To: balbi, gregkh; +Cc: linux-usb, linux-kernel, YueHaibing

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

ffs_prepare_buffer() should return an ERR_PTR() encoded error
code on failure.

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..cb419bbd089c 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 data;
 
 	pr_vdebug("Buffer from user space:\n");
 	ffs_dump_mem("", data, len);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] USB: gadget: f_fs: Remove unneed cast in ffs_prepare_buffer()
  2021-05-29 12:04 [PATCH -next] USB: gadget: f_fs: Remove unneed cast in ffs_prepare_buffer() YueHaibing
@ 2021-05-29 12:11 ` Greg KH
  2021-05-29 12:54   ` YueHaibing
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-05-29 12:11 UTC (permalink / raw)
  To: YueHaibing; +Cc: balbi, linux-usb, linux-kernel

On Sat, May 29, 2021 at 08:04:08PM +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
> 
> ffs_prepare_buffer() should return an ERR_PTR() encoded error
> code on failure.

It does return such a pointer today, so this statement does not make
much sense :(

And is this a v2 patch?  What changed from the previous version?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] USB: gadget: f_fs: Remove unneed cast in ffs_prepare_buffer()
  2021-05-29 12:11 ` Greg KH
@ 2021-05-29 12:54   ` YueHaibing
  0 siblings, 0 replies; 3+ messages in thread
From: YueHaibing @ 2021-05-29 12:54 UTC (permalink / raw)
  To: Greg KH; +Cc: balbi, linux-usb, linux-kernel

On 2021/5/29 20:11, Greg KH wrote:
> On Sat, May 29, 2021 at 08:04:08PM +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
>>
>> ffs_prepare_buffer() should return an ERR_PTR() encoded error
>> code on failure.
> 
> It does return such a pointer today, so this statement does not make
> much sense :(

Yes, it does. This is just to remove explicit casts.

> 
> And is this a v2 patch?  What changed from the previous version?

Sorry, I forget to add version info.

> 
> thanks,
> 
> greg k-h
> .
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-29 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-29 12:04 [PATCH -next] USB: gadget: f_fs: Remove unneed cast in ffs_prepare_buffer() YueHaibing
2021-05-29 12:11 ` Greg KH
2021-05-29 12:54   ` YueHaibing

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.