Commit 577f5f97 authored by Viresh Kumar's avatar Viresh Kumar Committed by Greg Kroah-Hartman

greybus: core: re-use gb_module_find() in gb_remove_module()

Also fix print message.
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent ab34291d
......@@ -162,19 +162,12 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id,
void gb_remove_module(struct greybus_host_device *hd, u8 module_id)
{
struct gb_module *gmod;
bool found = false;
list_for_each_entry(gmod, &hd->modules, links)
if (gmod->module_id == module_id) {
found = true;
break;
}
struct gb_module *gmod = gb_module_find(hd, module_id);
if (found)
if (gmod)
gb_module_destroy(gmod);
else
dev_err(hd->parent, "module id %d remove error\n", module_id);
dev_err(hd->parent, "module id %d not found\n", module_id);
}
static void gb_remove_modules(struct greybus_host_device *hd)
......
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