Commit 519bf3c3 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: protocol: warn on protocol put errors

Issue a warning if we fail to look up a protocol when dropping a
reference.

This should never happen as we hold a reference to the protocol module
and protocols should only be deregistered at module unload.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 78033844
...@@ -188,7 +188,6 @@ void gb_protocol_put(struct gb_protocol *protocol) ...@@ -188,7 +188,6 @@ void gb_protocol_put(struct gb_protocol *protocol)
u8 id; u8 id;
u8 major; u8 major;
u8 minor; u8 minor;
u8 protocol_count;
id = protocol->id; id = protocol->id;
major = protocol->major; major = protocol->major;
...@@ -196,16 +195,11 @@ void gb_protocol_put(struct gb_protocol *protocol) ...@@ -196,16 +195,11 @@ void gb_protocol_put(struct gb_protocol *protocol)
spin_lock_irq(&gb_protocols_lock); spin_lock_irq(&gb_protocols_lock);
protocol = gb_protocol_find(id, major, minor); protocol = gb_protocol_find(id, major, minor);
if (protocol) { if (WARN_ON(!protocol || !protocol->count))
protocol_count = protocol->count; goto out;
if (protocol_count)
protocol->count--; protocol->count--;
module_put(protocol->owner); module_put(protocol->owner);
} out:
spin_unlock_irq(&gb_protocols_lock); spin_unlock_irq(&gb_protocols_lock);
if (protocol)
WARN_ON(!protocol_count);
else
pr_err("protocol id %hhu version %hhu.%hhu not found\n",
id, major, minor);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment