From: Alexandre Bailon Date: Thu, 22 Jan 2015 07:23:37 +0000 (+0800) Subject: greybus: protocol.c: fix a kernel panic caused by __gb_protocol_register X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c2f792382bc23bddd67a5da72faf9d46bf0f3ef9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git greybus: protocol.c: fix a kernel panic caused by __gb_protocol_register __gb_protocol_register check if the protocol is not already registred, and then register it. It register in existing->lists but at this point, existing is always NULL (we exist just before if not). Use gb_protocols instead. Signed-off-by: Alexandre Bailon Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/protocol.c b/drivers/staging/greybus/protocol.c index ae8ab21ee920..400f73386474 100644 --- a/drivers/staging/greybus/protocol.c +++ b/drivers/staging/greybus/protocol.c @@ -70,7 +70,7 @@ int __gb_protocol_register(struct gb_protocol *protocol, struct module *module) * We need to insert the protocol here, before the existing one * (or before the head if we searched the whole list) */ - list_add_tail(&protocol->links, &existing->links); + list_add_tail(&protocol->links, &gb_protocols); spin_unlock_irq(&gb_protocols_lock); pr_info("Registered %s protocol.\n", protocol->name);