[PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in drivers/usb

2019-06-17 Thread dmg
From: Daniel M German Use min_t to find the minimum of two values instead of using the ?: operator. This change does not alter functionality. It is merely cosmetic intended to improve the readability of the code. Signed-off-by: Daniel M German --- drivers/usb/gadget/function/u_ether.c | 2 +-

Re: [PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in drivers/usb

2019-06-18 Thread dmg
uot;Beauty is the first test; there is no permanent place in the world for ugly G. H. Hardy -> mathematics." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .

[PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in adutux driver

2019-06-18 Thread dmg
From: Daniel M German Use min_t to find the minimum of two values instead of using the ?: operator. We use min_t instead of min to avoid the compilation warning 'comparison of distinct pointer types lacks a cast'. This change does not alter functionality. It is merely cosmetic intended to impro

Re: [PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in adutux driver

2019-06-18 Thread dmg
e. I agree. I'll address this issue. Sorry for the wasted bandwidh, and thank you for the suggestion, --dmg

Re: [PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in adutux driver

2019-06-18 Thread dmg
atch. > > thanks, > > greg k-h -- Daniel M. German "The fear is not losing. Phil Jackson -> The fear is not producing the effort needed." http://turingmachine.org/ http://silvernegative.com/ dmg (at) uvic (dot) ca replace (at) with @ and (dot) with .

Re: [PATCH] usb: Replace a < b ? a : b construct with min_t(type, a, b) in adutux driver

2019-06-19 Thread dmg
Greg KH writes: > On Tue, Jun 18, 2019 at 10:22:52AM -0700, dmg wrote: >> >> Greg KH writes: >> >> >> diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c >> >> index 9465fb95d70a..4a9fa3152f2a 100644 >> >> --- a/driver

[PATCH] usb: clean up some of the computations in adu_read

2019-06-19 Thread dmg
From: Daniel M German Replace ?: with min to calculate the number of bytes in the secondary buffer, including changing the data type of data_in_secondary to size_t to be type-consistent. data_in_secondary can never be negative. Remove some spurious calculations (copy_to_user returns zero on succ

[PATCH] usb: Replace snprintf with scnprintf in gether_get_ifname

2019-06-19 Thread dmg
From: Daniel M German snprintf returns the actual length of the buffer created; however, this is not the case if snprintf truncates its parameter. See https://lwn.net/Articles/69419/ for a detailed explanation. The current code correctly handles this case at the expense of extra code in the retur

Re: [usb:usb-testing 46/46] drivers/usb//misc/adutux.c:375:4: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}'

2019-06-20 Thread dmg
way to deal with this? casting size_t to long unsigned int will work, but it sounds kind of ugly. thank you, --daniel -- Daniel M. German "We die. That may be the meaning of life. But we do language. That may be Toni Morrison ->

[PATCH] usb: clean up some of the computations in adu_read

2019-06-20 Thread dmg
From: Daniel M German Replace ?: with min to calculate the number of bytes in the secondary buffer, including changing the data type of data_in_secondary to size_t to be type-consistent. data_in_secondary can never be negative. Remove some spurious calculations (copy_to_user returns zero on succ

[PATCH v3] usb: clean up some of the computations in adu_read

2019-06-21 Thread dmg
From: Daniel M German Replace ?: with min to calculate the number of bytes in the secondary buffer, including changing the data type of data_in_secondary to size_t to be type-consistent. data_in_secondary can never be negative. Remove some spurious calculations (copy_to_user returns zero on succ

Re: [PATCH v3] usb: clean up some of the computations in adu_read

2019-06-21 Thread dmg
d...@turingmachine.org writes: > From: Daniel M German > Sorry, I put a spurious line in the body of the email. I am resending. --dmg