When removing a connection with no protocol assigned to it, the kernel
oopses as we always thought protocols were always there.
Fix that problem, oopses are bad.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Reviewed-by: Alex Elder <elder@linaro.org>
void gb_protocol_put(struct gb_protocol *protocol)
{
- u8 major = protocol->major;
- u8 minor = protocol->minor;
+ u8 major;
+ u8 minor;
u8 protocol_count;
+ if (!protocol)
+ return;
+
+ major = protocol->major;
+ minor = protocol->minor;
+
spin_lock_irq(&gb_protocols_lock);
protocol = _gb_protocol_find(protocol->id, protocol->major,
protocol->minor);