summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/greybus/module.c')
-rw-r--r--drivers/staging/greybus/module.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c
index f9415c0f735e..54e8f9e68d25 100644
--- a/drivers/staging/greybus/module.c
+++ b/drivers/staging/greybus/module.c
@@ -70,6 +70,13 @@ struct gb_module *gb_module_create(struct greybus_host_device *hd, u8 module_id)
struct gb_module *gmod;
int retval;
+ gmod = gb_module_find(hd, module_id);
+ if (gmod) {
+ dev_err(hd->parent, "Duplicate module id %d will not be created\n",
+ module_id);
+ return NULL;
+ }
+
gmod = kzalloc(sizeof(*gmod), GFP_KERNEL);
if (!gmod)
return NULL;