Re: [PATCH 4/5] rtl8712: replace min with min_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 09, 2012 at 10:15:09AM +0000, Przemo Firszt wrote:
> A clean up change suggested by checkpatch.pl
> 
> Signed-off-by: Przemo Firszt <przemo@xxxxxxxxx>
> ---
>  drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> index cdb51d7..b131b61 100644
> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -188,8 +188,7 @@ static inline char *translate_scan(struct _adapter *padapter,
>  	/* Add the ESSID */
>  	iwe.cmd = SIOCGIWESSID;
>  	iwe.u.data.flags = 1;
> -	iwe.u.data.length = (u16)min((u16)pnetwork->network.Ssid.SsidLength,
> -			    (u16)32);
> +	iwe.u.data.length = min_t(u16, pnetwork->network.Ssid.SsidLength, 32);

pnetwork->network.Ssid.SsidLength is a u32 so it would be better to
not truncate the upper bits away.  It's not going to cause a
problem, but its slightly messy.

This is a common problem where people take the type of
iwe.u.data.length and cast to that instead of considering the types
for the data they are comparing.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux