greybus: fix a leak on error in gb_module_create()

We should release ->interfaces[0] as well.

Fixes: b15d97d770 ("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>
This commit is contained in:
Dan Carpenter 2016-10-14 22:18:21 +03:00 committed by Greg Kroah-Hartman
parent 1305f2b2f5
commit e866dd8aab
1 changed files with 1 additions and 1 deletions

View File

@ -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);