Re: [PATCH] misc: Return error on error path
From: Andy Shevchenko
Date: Mon Jul 31 2017 - 12:25:23 EST
On Mon, Jul 31, 2017 at 6:48 PM, Anton Vasilyev <vasilyev@xxxxxxxxx> wrote:
> If ibmasm_event_buffer_init() or ibmasm_heartbeat_init() fails,
> then ibmasm_init_one() release all resources and return 0 on error path.
>
> The patch adds corresponding error for fails.
>
> Found by Linux Driver Verification project (linuxtesting.org).
To me looks better to
- return 1;
+ return -ENOMEM;
in event.c, and then...
> if (ibmasm_event_buffer_init(sp)) {
> dev_err(sp->dev, "Failed to allocate event buffer\n");
> + result = -ENOMEM;
> goto error_eventbuffer;
> }
result = ibmasm_event_buffer_init(sp);
if (result) {
...
}
> if (ibmasm_heartbeat_init(sp)) {
> dev_err(sp->dev, "Failed to allocate heartbeat command\n");
> + result = -ENOMEM;
> goto error_heartbeat;
> }
Ditto.
--
With Best Regards,
Andy Shevchenko