summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-10-14 22:18:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-24 15:51:00 +0200
commite866dd8aab76b6a0ee8428491e65fa5c83a6ae5a (patch)
tree7c266a7c306f343c123ac75433cf0c673a28b1c6 /drivers/staging
parent1305f2b2f52af5986f44dfbb1a6fe58ae875aa61 (diff)
greybus: fix a leak on error in gb_module_create()
We should release ->interfaces[0] as well. Fixes: b15d97d77017 ("greybus: core: add module abstraction") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/module.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c
index 69f67ddbd4a3..660b4674a76f 100644
--- a/drivers/staging/greybus/module.c
+++ b/drivers/staging/greybus/module.c
@@ -127,7 +127,7 @@ struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
return module;
err_put_interfaces:
- for (--i; i > 0; --i)
+ for (--i; i >= 0; --i)
gb_interface_put(module->interfaces[i]);
put_device(&module->dev);