[U-Boot] [linux-sunxi] [PATCH 1/8] usb: musb-new: Fix improper musb host pointer

Julian Calaby julian.calaby at gmail.com
Tue Jul 17 12:45:10 UTC 2018


Hi Jagan,

On Tue, Jul 10, 2018 at 5:17 AM Jagan Teki <jagan at amarulasolutions.com> wrote:
>
> When MUSB is operating in peripheral mode, probe registering
> musb core using musb_register which intern return int value
> for validation. so there is no scope to preserve struct musb
> pointer but the same can be used in .remove musb_stop.
> So fix this by return musb_register with struct musb pointer.
>
> Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
> ---
>  board/compulab/cm_t3517/cm_t3517.c |  4 ++--
>  drivers/usb/musb-new/musb_uboot.c  | 10 +++++-----
>  drivers/usb/musb-new/pic32.c       |  6 ++++--
>  drivers/usb/musb-new/sunxi.c       |  8 +++++---
>  include/linux/usb/musb.h           |  4 ++--
>  5 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
> index 2b04fbd046..3cd89793c9 100644
> --- a/drivers/usb/musb-new/musb_uboot.c
> +++ b/drivers/usb/musb-new/musb_uboot.c
> @@ -436,14 +436,14 @@ int musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
>                 break;
>  #endif
>         default:
> -               return -EINVAL;
> +               return NULL;

These error constants appear to have been chosen specifically, so
would it be nicer to preserve them and use ERR_PTR() and friends to
return them?

(I know nothing checks them today, but they might be useful in the future)

>         }
>
>         *musbp = musb_init_controller(plat, (struct device *)bdata, ctl_regs);
>         if (!*musbp) {
>                 printf("Failed to init the controller\n");
> -               return -EIO;
> +               return NULL;
>         }
>
> -       return 0;
> +       return *musbp;
>  }

Thanks,

-- 
Julian Calaby

Email: julian.calaby at gmail.com
Profile: http://www.google.com/profiles/julian.calaby/


More information about the U-Boot mailing list