Skip to contentSkip to conversation

drivers: usb: musb: Fail if the ctrl mod register is missing

PATCH Superseded Arnaud Ferraris 2 participants 5 messages Apr 22, 2020 USB

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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)

---

 drivers/usb/musb-new/ti-musb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/musb-new/ti-musb.c +5 -0
index 608facefa3..4e88652433 100644
@@ -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 == FDT_ADDR_T_NONE) {
+		pr_err("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.1
#1 lore raw

PATCH 2/2 drivers: usb: musb: Fix comparison between pointer and integer warn

From: Adrian Ratiu <[email protected]>

drivers/usb/musb-new/ti-musb.c: In function 'ti_musb_ofdata_to_platdata':
drivers/usb/musb-new/ti-musb.c:93:30: warning: comparison between pointer and integer

	if (platdata->ctrl_mod_base == FDT_ADDR_T_NONE) {}

---

 drivers/usb/musb-new/ti-musb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb-new/ti-musb.c +1 -1
index 4e88652433..0c124a2c5e 100644
@@ -91,7 +91,7 @@ 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 == FDT_ADDR_T_NONE) {
+	if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE) {
 		pr_err("MUSB ctrl mod missing\n");
 		return -ENOENT;
 	}
Signature · 1 line
2.26.1
#2 lore raw

PATCH 2/2 drivers: usb: musb: Fix comparison between pointer and integer warn

Quoted 18 lines · Arnaud Ferraris

From: Adrian Ratiu <[email protected]>

drivers/usb/musb-new/ti-musb.c: In function 'ti_musb_ofdata_to_platdata':
drivers/usb/musb-new/ti-musb.c:93:30: warning: comparison between pointer and integer

	if (platdata->ctrl_mod_base == FDT_ADDR_T_NONE) {}

---

 drivers/usb/musb-new/ti-musb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/musb-new/ti-musb.c +0 -0
index 4e88652433..0c124a2c5e 100644

drivers/usb/musb-new/ti-musb.c static int ti_musb_ofdata_to_platdata(struct udevice *dev) · line 95

Quoted 6 lines
drivers/usb/musb-new/ti-musb.c +1 -1
@@ -91,7 +91,7 @@ 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 == FDT_ADDR_T_NONE) {
+	if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE) {
 		pr_err("MUSB ctrl mod missing\n");

Is this patching the same code as 1/2 ?

#3 lore raw

PATCH 2/2 drivers: usb: musb: Fix comparison between pointer and integer warn

Le 22/04/2020 ? 12:53, Marek Vasut a ?crit?:

Quoted 6 lines · Arnaud Ferraris
Quoted 5 lines
drivers/usb/musb-new/ti-musb.c +0 -0
index 4e88652433..0c124a2c5e 100644
@@ -91,7 +91,7 @@ static int ti_musb_ofdata_to_platdata(struct udevice *dev)
Quoted 9 lines

drivers/usb/musb-new/ti-musb.c static int ti_musb_ofdata_to_platdata(struct udevice *dev) · line 95

Quoted 6 lines
drivers/usb/musb-new/ti-musb.c +1 -1
 	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 == FDT_ADDR_T_NONE) {
+	if (platdata->ctrl_mod_base == (void *)FDT_ADDR_T_NONE) {
 		pr_err("MUSB ctrl mod missing\n");

Is this patching the same code as 1/2 ?

It is indeed. I kept it that way as the original commits were from different authors and different times, but I can squash those.

Cheers,
Arnaud

#4 lore raw

PATCH 1/2 drivers: usb: musb: Fail if the ctrl mod register is missing

In reply to Arnaud Ferraris
Quoted 17 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)

---

 drivers/usb/musb-new/ti-musb.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/usb/musb-new/ti-musb.c +0 -0
index 608facefa3..4e88652433 100644

drivers/usb/musb-new/ti-musb.c static int ti_musb_ofdata_to_platdata(struct udevice *dev) · line 95

Quoted 5 lines
drivers/usb/musb-new/ti-musb.c +2 -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 == FDT_ADDR_T_NONE) {
+		pr_err("MUSB ctrl mod missing\n");

dev_err()