Skip to content

Commit

Permalink
greybus: fix a leak on error in gb_module_create()
Browse files Browse the repository at this point in the history
We should release ->interfaces[0] as well.

Fixes: b15d97d ("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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Oct 24, 2016
1 parent 1305f2b commit e866dd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/greybus/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e866dd8

Please sign in to comment.