Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1700172

Re: [PATCH] misc: Return error on error path

From Andy Shevchenko <andy.shevchenko@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] misc: Return error on error path
Date 2017-07-31 18:30 +0200
Message-ID <u9lJU-8uS-13@gated-at.bofh.it> (permalink)
References <u9lgS-85O-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jul 31, 2017 at 6:48 PM, Anton Vasilyev <vasilyev@ispras.ru> 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

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

[PATCH] misc: Return error on error path Anton Vasilyev <vasilyev@ispras.ru> - 2017-07-31 18:00 +0200
  Re: [PATCH] misc: Return error on error path Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-07-31 18:30 +0200

csiph-web