[PATCH 4/5] USB: OTG: Add check for roothub initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tony Lindgren <tony@xxxxxxxxxxx>

Roothub may not be initialized if no gadget is loaded on musb
for example. Add check for roothub initialization. Also make
comment more accurate.

Signed-off-by: Tony Lindgren <tony@xxxxxxxxxxx>
Signed-off-by: Felipe Balbi <me@xxxxxxxxxxxxxxx>
---
 drivers/usb/core/otg.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/core/otg.c b/drivers/usb/core/otg.c
index e9ece31..9a2ce7e 100644
--- a/drivers/usb/core/otg.c
+++ b/drivers/usb/core/otg.c
@@ -33,16 +33,25 @@ struct otg_transceiver *otg_get_transceiver(void)
 }
 EXPORT_SYMBOL(otg_get_transceiver);
 
-/* OTG MESSAGE: report errors here, customize to match your product */
+/*
+ * OTG MESSAGE: report errors here, customize to match your product
+ * See also otg_last_error_show().
+ */
 void otg_set_error(struct otg_transceiver *x, enum usb_otg_error errno)
 {
 	if (!x)
 		return;
+
 	if (!x->tpl_enabled)
 		x->last_error = OTG_ERR_DEVICE_SUPPORTED;
 	else
 		x->last_error = errno;
 
+	if (!x->host->root_hub) {
+		printk(KERN_WARNING "OTG: root hub not yet initialized\n");
+		return;
+	}
+
 	sysfs_notify(&x->host->root_hub->dev.kobj, NULL, "otg_last_error");
 }
 EXPORT_SYMBOL(otg_set_error);
-- 
1.5.4.rc3.24.gb53139

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux