Update min() to min_t()
PATCH 1/1 Update min() to min_t()
This patch fixes the checkpatch.pl warning:
WARNING: min() should probably be min_t(size_t, count, MAX_TRANSFER)
+ size_t writesize = min(count, (size_t)MAX_TRANSFER);
--- drivers/usb/usb-skeleton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usb-skeleton.c +1 -1
@@ -363,7 +363,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,int retval =0 ;struct urb *urb =NULL ;char *buf =NULL ; -size_t writesize =min (count, (size_t )MAX_TRANSFER ); +size_t writesize =min_t (size_t, count,MAX_TRANSFER ); dev = file->private_data;
Signature · 1 line
2.25.1
Greg KH
maintainerQuoted 8 lines · Philipp Hortmann
This patch fixes the checkpatch.pl warning:
WARNING:min()should probably bemin_t(size_t, count, MAX_TRANSFER)(quoted diff) +1
-0+ size_t writesize = min(count, (size_t)MAX_TRANSFER);Signed-off-by Philipp Hortmann <[email protected]>--- drivers/usb/usb-skeleton.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Please resend with the subject line adding the subsystem and driver name so that we can better know what you are modifying here.
Quoted 16 lines
drivers/usb/usb-skeleton.c +1
-1@@ -363,7 +363,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,int retval =0 ;struct urb *urb =NULL ;char *buf =NULL ; -size_t writesize =min (count, (size_t )MAX_TRANSFER ); +size_t writesize =min_t (size_t, count,MAX_TRANSFER ); dev = file->private_data;Signature · 1 line
2.25.1
Has anyone actually built this driver in a while?
thanks,
greg k-h
Quoted 20 lines · Greg KH
Quoted 16 lines · Philipp Hortmann
drivers/usb/usb-skeleton.c +1
-1@@ -363,7 +363,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,int retval =0 ;struct urb *urb =NULL ;char *buf =NULL ; -size_t writesize =min (count, (size_t )MAX_TRANSFER ); +size_t writesize =min_t (size_t, count,MAX_TRANSFER ); dev = file->private_data;Signature · 1 line
2.25.1Has anyone actually built this driver in a while?
Quoted 4 lines
thanks,
greg k-h
Hi,
I have build and loaded the driver. To me this seems OK.
dmesg from loading:usb_skeleton: loading out-of-tree module taints kernel.usb_skeleton: module verification failed: signature and/or required key missing - tainting kernel
usbcore: registered new interface driver skeleton
dmesg from unloading:
usbcore: deregistering interface driver skeleton
Used kernel 5.15.0-rc1+
Bye Philipp
Greg KH
maintainerQuoted 33 lines · Philipp Hortmann
Quoted 18 lines · Greg KH
Quoted 14 lines · Philipp Hortmann
drivers/usb/usb-skeleton.c +1
-1@@ -363,7 +363,7 @@ static ssize_t skel_write(struct file *file, const char *user_buffer,int retval =0 ;struct urb *urb =NULL ;char *buf =NULL ; -size_t writesize =min (count, (size_t )MAX_TRANSFER ); +size_t writesize =min_t (size_t, count,MAX_TRANSFER ); dev = file->private_data;Signature · 1 line
2.25.1Has anyone actually built this driver in a while?
Quoted 4 lines
thanks,
greg k-h
Hi,
I have build and loaded the driver. To me this seems OK.
dmesg from loading:
usb_skeleton: loading out-of-tree module taints kernel.usb_skeleton: module verification failed: signature and/or required key missing - tainting kernel
usbcore: registered new interface driver skeleton
Quoted 4 lines
dmesg from unloading:
usbcore: deregistering interface driver skeletonUsed kernel 5.15.0-rc1+
Great, can you resend a v2 of this with a fixed up subject line please?
thanks,
greg k-h