drivers: usb: musb: Fail if the ctrl mod register is missing
PATCH v2 1/2 drivers: usb: musb: Fail if the ctrl mod register is missing
From: Sjoerd Simons <[email protected]>
If the trcl mode register address cannot be found error out rather then trying to continue (which cannot work)
---
Changes in v2:
- squashed commits as they both affect the same code
- replaced pr_err() with dev_err()
drivers/usb/musb-new/ti-musb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/musb-new/ti-musb.c +5 -0
@@ -91,6 +91,11 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) phys =fdtdec_lookup_phandle (fdt, node,"phys" ); ctrl_mod =fdtdec_lookup_phandle (fdt, phys,"ti,ctrl_mod" ); platdata->ctrl_mod_base = (void *)fdtdec_get_addr (fdt, ctrl_mod,"reg" ); +if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE ) { +dev_err (dev,"MUSB ctrl mod missing\n" ); +return -ENOENT ; + } + usb_index =ti_musb_get_usb_index (node);switch (usb_index) {case 1 :
Signature · 1 line
2.26.2
PATCH v2 2/2 drivers: usb: musb: ti: Use dev_err instead of pr_err
In order to maintain consistency, every call to pr_err() is replaced with dev_err().
---
Changes in v2:
- added in v2
drivers/usb/musb-new/ti-musb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/usb/musb-new/ti-musb.c +8 -8
@@ -114,7 +114,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) musb_config->multipoint =fdtdec_get_int (fdt, node,"mentor,multipoint" ,-1 );if (musb_config->multipoint <0 ) { -pr_err ("MUSB multipoint DT entry missing\n" ); +dev_err (dev,"MUSB multipoint DT entry missing\n" );return -ENOENT ; }
@@ -123,14 +123,14 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) musb_config->num_eps =fdtdec_get_int (fdt, node,"mentor,num-eps" ,-1 );if (musb_config->num_eps <0 ) { -pr_err ("MUSB num-eps DT entry missing\n" ); +dev_err (dev,"MUSB num-eps DT entry missing\n" );return -ENOENT ; } musb_config->ram_bits =fdtdec_get_int (fdt, node,"mentor,ram-bits" ,-1 );if (musb_config->ram_bits <0 ) { -pr_err ("MUSB ram-bits DT entry missing\n" ); +dev_err (dev,"MUSB ram-bits DT entry missing\n" );return -ENOENT ; }
@@ -138,7 +138,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) platdata->plat.power =fdtdec_get_int (fdt, node,"mentor,power" ,-1 );if (platdata->plat.power <0 ) { -pr_err ("MUSB mentor,power DT entry missing\n" ); +dev_err (dev,"MUSB mentor,power DT entry missing\n" );return -ENOENT ; }
@@ -189,7 +189,7 @@ static int ti_musb_host_ofdata_to_platdata(struct udevice *dev) ret =ti_musb_ofdata_to_platdata (dev);if (ret) { -pr_err ("platdata dt parse error\n" ); +dev_err (dev,"platdata dt parse error\n" );return ret; }
@@ -227,7 +227,7 @@ static int ti_musb_peripheral_ofdata_to_platdata(struct udevice *dev) ret =ti_musb_ofdata_to_platdata (dev);if (ret) { -pr_err ("platdata dt parse error\n" ); +dev_err (dev,"platdata dt parse error\n" );return ret; } platdata->plat.mode =MUSB_PERIPHERAL ;
@@ -312,7 +312,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) node, &dev);if (ret) -pr_err ("musb - not able to bind usb peripheral node\n" ); +dev_err (dev,"musb - not able to bind usb peripheral node\n" );break ;case USB_DR_MODE_HOST :/* Bind MUSB host */
@@ -322,7 +322,7 @@ static int ti_musb_wrapper_bind(struct udevice *parent) node, &dev);if (ret) -pr_err ("musb - not able to bind usb host node\n" ); +dev_err (dev,"musb - not able to bind usb host node\n" );break ;default :break ;
Signature · 1 line
2.26.2
PATCH v2 1/2 drivers: usb: musb: Fail if the ctrl mod register is missing
In reply to Arnaud FerrarisQuoted 22 lines · Arnaud Ferraris
From: Sjoerd Simons <[email protected]>
If the trcl mode register address cannot be found error out rather then trying to continue (which cannot work)
Signed-off-by Sjoerd Simons <[email protected]>Signed-off-by Adrian Ratiu <[email protected]>Signed-off-by Arnaud Ferraris <[email protected]>---
Changes in v2:
- squashed commits as they both affect the same code
- replacedpr_err()withdev_err()drivers/usb/musb-new/ti-musb.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/usb/musb-new/ti-musb.c +0
-0
drivers/usb/musb-new/ti-musb.c static int ti_musb_ofdata_to_platdata(struct udevice *dev) · line 97
Quoted 7 lines
drivers/usb/musb-new/ti-musb.c +4
-0@@ -91,6 +91,11 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev) phys =fdtdec_lookup_phandle (fdt, node,"phys" ); ctrl_mod =fdtdec_lookup_phandle (fdt, phys,"ti,ctrl_mod" ); platdata->ctrl_mod_base = (void *)fdtdec_get_addr (fdt, ctrl_mod,"reg" ); +if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE ) { +dev_err (dev,"MUSB ctrl mod missing\n" ); +return -ENOENT ; + }
When does this happen ?