[PATCH] staging: emxx_udc: Use min_t instead of min

Daniel Baluta daniel.baluta at gmail.com
Mon Sep 29 22:12:43 EEST 2014


On Mon, Sep 29, 2014 at 10:11 PM, Georgiana Chelu
<georgiana.chelu93 at gmail.com> wrote:
> This fixes the following checkpatch.pl warnings:
> WARNING: min() should probably be min_t(u32, iBufSize, ep->ep.maxpacket)
> WARNING: min() should probably be min_t(u32, data_size, ep->ep.maxpacket)
> WARNING: min() should probably be min_t(u16, udc->ctrl.wLength, sizeof(status_data))

Please try to compile your code. As you can see min_t expects 3
parameters, but in your
code it only gets 2.

>
> Signed-off-by: Georgiana Chelu <georgiana.chelu93 at gmail.com>
> ---
>  drivers/staging/emxx_udc/emxx_udc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
> index 57a9bf2..edb4112 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.c
> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> @@ -971,7 +971,7 @@ static int _nbu2ss_epn_out_data(
>                 && (iBufSize  >= sizeof(u32))) {
>                 nret = _nbu2ss_out_dma(udc, req, num, iBufSize);
>         } else {
> -               iBufSize = min(iBufSize, (u32)ep->ep.maxpacket);
> +               iBufSize = min_t(iBufSize, (u32)ep->ep.maxpacket);
>                 nret = _nbu2ss_epn_out_pio(udc, ep, req, iBufSize);
>         }
>
> @@ -1185,7 +1185,7 @@ static int _nbu2ss_epn_in_data(
>                 && (data_size >= sizeof(u32))) {
>                 nret = _nbu2ss_in_dma(udc, ep, req, num, data_size);
>         } else {
> -               data_size = min(data_size, (u32)ep->ep.maxpacket);
> +               data_size = min_t(data_size, (u32)ep->ep.maxpacket);
>                 nret = _nbu2ss_epn_in_pio(udc, ep, req, data_size);
>         }
>
> @@ -1604,7 +1604,7 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
>                 return result;
>         }
>
> -       length = min(udc->ctrl.wLength, (u16)sizeof(status_data));
> +       length = min_t(udc->ctrl.wLength, (u16)sizeof(status_data));
>
>         switch (recipient) {
>         case USB_RECIP_DEVICE:
> --
> 1.9.1
>
>


More information about the firefly mailing list