greybus: connection: fix locking in gb_hd_connection_find
Fix unconditional re-enabling of interrupts in gb_hd_connection_find, which can be called with local interrupts disabled from the USB completion handler. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
parent
d1b20d72ae
commit
8f5eadb7ea
|
@ -18,14 +18,15 @@ struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd,
|
||||||
u16 cport_id)
|
u16 cport_id)
|
||||||
{
|
{
|
||||||
struct gb_connection *connection = NULL;
|
struct gb_connection *connection = NULL;
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
spin_lock_irq(&gb_connections_lock);
|
spin_lock_irqsave(&gb_connections_lock, flags);
|
||||||
list_for_each_entry(connection, &hd->connections, hd_links)
|
list_for_each_entry(connection, &hd->connections, hd_links)
|
||||||
if (connection->hd_cport_id == cport_id)
|
if (connection->hd_cport_id == cport_id)
|
||||||
goto found;
|
goto found;
|
||||||
connection = NULL;
|
connection = NULL;
|
||||||
found:
|
found:
|
||||||
spin_unlock_irq(&gb_connections_lock);
|
spin_unlock_irqrestore(&gb_connections_lock, flags);
|
||||||
|
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue