diff mbox series

[v2,1/2] drivers: usb: musb: Fail if the ctrl mod register is missing

Message ID 20200506103940.64454-1-arnaud.ferraris@collabora.com
State New
Delegated to: Marek Vasut
Headers show
Series [v2,1/2] drivers: usb: musb: Fail if the ctrl mod register is missing | expand

Commit Message

Arnaud Ferraris May 6, 2020, 10:39 a.m. UTC
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>

If the trcl mode register address cannot be found error out rather then
trying to continue (which cannot work)

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
---

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(+)

Comments

Marek Vasut May 6, 2020, 10:51 a.m. UTC | #1
On 5/6/20 12:39 PM, Arnaud Ferraris wrote:
> From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> 
> If the trcl mode register address cannot be found error out rather then
> trying to continue (which cannot work)
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
> ---
> 
> 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(+)
> 
> diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
> index 608facefa3..56d6134dc6 100644
> --- a/drivers/usb/musb-new/ti-musb.c
> +++ b/drivers/usb/musb-new/ti-musb.c
> @@ -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 ?
diff mbox series

Patch

diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 608facefa3..56d6134dc6 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -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: