[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VcwZHH5pdmCe9Y_kqEmVH9ELbPWB+ao0dNszNN4Fc3e2Q@mail.gmail.com>
Date: Mon, 31 Jul 2017 19:25:17 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Anton Vasilyev <vasilyev@...ras.ru>
Cc: Colin Ian King <colin.king@...onical.com>,
Jiri Kosina <jkosina@...e.cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
ldv-project@...uxtesting.org
Subject: Re: [PATCH] misc: Return error on error path
On Mon, Jul 31, 2017 at 6:48 PM, Anton Vasilyev <vasilyev@...ras.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
Powered by blists - more mailing lists