diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2013-06-18 10:28:48 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-18 14:02:04 -0400 |
commit | 41341261aa1707b49f937ba2c20d1a0daa5afac3 (patch) | |
tree | 7f7e80ab0396c7b0381013461d94ef9af852168a /drivers/usb/core/port.c | |
parent | 025f880cb2e4d7218d0422d4b07bea1a68959c38 (diff) |
usb: check usb_hub_to_struct_hub() return value
usb_hub_to_struct_hub() can return NULL in some unlikely cases.
Add checks where appropriate, or pass the hub pointer as an additional
argument if it's known to be valid.
The places it makes sense to check usb_hub_to_struct_hub()
are picked based on feedback from Alan Stern.
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/core/port.c')
-rw-r--r-- | drivers/usb/core/port.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c index b8bad294eeb8..5fd3fee58f8b 100644 --- a/drivers/usb/core/port.c +++ b/drivers/usb/core/port.c | |||
@@ -86,7 +86,7 @@ static int usb_port_runtime_resume(struct device *dev) | |||
86 | usb_autopm_get_interface(intf); | 86 | usb_autopm_get_interface(intf); |
87 | set_bit(port1, hub->busy_bits); | 87 | set_bit(port1, hub->busy_bits); |
88 | 88 | ||
89 | retval = usb_hub_set_port_power(hdev, port1, true); | 89 | retval = usb_hub_set_port_power(hdev, hub, port1, true); |
90 | if (port_dev->child && !retval) { | 90 | if (port_dev->child && !retval) { |
91 | /* | 91 | /* |
92 | * Wait for usb hub port to be reconnected in order to make | 92 | * Wait for usb hub port to be reconnected in order to make |
@@ -128,7 +128,7 @@ static int usb_port_runtime_suspend(struct device *dev) | |||
128 | 128 | ||
129 | usb_autopm_get_interface(intf); | 129 | usb_autopm_get_interface(intf); |
130 | set_bit(port1, hub->busy_bits); | 130 | set_bit(port1, hub->busy_bits); |
131 | retval = usb_hub_set_port_power(hdev, port1, false); | 131 | retval = usb_hub_set_port_power(hdev, hub, port1, false); |
132 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); | 132 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION); |
133 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); | 133 | usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_ENABLE); |
134 | clear_bit(port1, hub->busy_bits); | 134 | clear_bit(port1, hub->busy_bits); |