On Tue, Jun 18, 2019 at 08:35:29AM -0700, d...@turingmachine.org wrote:
> From: Daniel M German <d...@turingmachine.org>
> 
> 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
> improve the readability of the code.
> 
> Signed-off-by: Daniel M German <d...@turingmachine.org>
> ---
>  drivers/usb/misc/adutux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c
> index 9465fb95d70a..4a9fa3152f2a 100644
> --- a/drivers/usb/misc/adutux.c
> +++ b/drivers/usb/misc/adutux.c
> @@ -379,7 +379,7 @@ static ssize_t adu_read(struct file *file, __user char 
> *buffer, size_t count,
>  
>               if (data_in_secondary) {
>                       /* drain secondary buffer */
> -                     int amount = bytes_to_read < data_in_secondary ? 
> bytes_to_read : data_in_secondary;
> +                     int amount = min_t(size_t, bytes_to_read, 
> data_in_secondary);

Shouldn't amount and data_in_secondary be of size_t type?  Then you can
just use min() here, right?

thanks,

greg k-h

Reply via email to