Commit 3014712f authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: endo: fix device-id allocation

During endo registration, a unique device id was allocated but then
never used. Instead the default dev_id 0 (due to kzalloc) was used for
device-generation and later for id-deallocation.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 16cd787d
...@@ -438,11 +438,14 @@ static int create_modules(struct gb_endo *endo) ...@@ -438,11 +438,14 @@ static int create_modules(struct gb_endo *endo)
static int gb_endo_register(struct greybus_host_device *hd, static int gb_endo_register(struct greybus_host_device *hd,
struct gb_endo *endo) struct gb_endo *endo)
{ {
int dev_id;
int retval; int retval;
retval = ida_simple_get(&greybus_endo_id_map, 0, 0, GFP_KERNEL); dev_id = ida_simple_get(&greybus_endo_id_map, 0, 0, GFP_KERNEL);
if (retval < 0) if (dev_id < 0)
return retval; return dev_id;
endo->dev_id = dev_id;
endo->dev.parent = hd->parent; endo->dev.parent = hd->parent;
endo->dev.bus = &greybus_bus_type; endo->dev.bus = &greybus_bus_type;
......
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