From: Viresh Kumar Date: Fri, 14 Nov 2014 11:55:05 +0000 (+0530) Subject: greybus: core: re-use gb_module_find() in gb_remove_module() X-Git-Tag: v4.13~2185^2~378^2~21^2~1895 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=577f5f974c874228573451b9a521df7962f8b7de;p=mirror_ubuntu-bionic-kernel.git greybus: core: re-use gb_module_find() in gb_remove_module() Also fix print message. Signed-off-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c index 4604649b5698..851a3021259f 100644 --- a/drivers/staging/greybus/core.c +++ b/drivers/staging/greybus/core.c @@ -162,19 +162,12 @@ err_module: 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)