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: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
parent
78033844da
commit
519bf3c3b9
@ -188,7 +188,6 @@ void gb_protocol_put(struct gb_protocol *protocol)
|
||||
u8 id;
|
||||
u8 major;
|
||||
u8 minor;
|
||||
u8 protocol_count;
|
||||
|
||||
id = protocol->id;
|
||||
major = protocol->major;
|
||||
@ -196,16 +195,11 @@ void gb_protocol_put(struct gb_protocol *protocol)
|
||||
|
||||
spin_lock_irq(&gb_protocols_lock);
|
||||
protocol = gb_protocol_find(id, major, minor);
|
||||
if (protocol) {
|
||||
protocol_count = protocol->count;
|
||||
if (protocol_count)
|
||||
protocol->count--;
|
||||
module_put(protocol->owner);
|
||||
}
|
||||
if (WARN_ON(!protocol || !protocol->count))
|
||||
goto out;
|
||||
|
||||
protocol->count--;
|
||||
module_put(protocol->owner);
|
||||
out:
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user