Re: [PATCH net-next v4 1/2] netconsole: Create a allocation helper

From: Jakub Kicinski
Date: Tue Aug 08 2023 - 17:55:29 EST


On Fri, 4 Aug 2023 05:43:20 -0700 Breno Leitao wrote:
> + struct netconsole_target *nt = alloc_and_init();
> + int err = -ENOMEM;
> +
> + if (!nt)
> + goto fail;

No complex code in the variable init, please.
Makes the code harder to read.

struct netconsole_target *nt;
int err;

nt = alloc_and_init();
if (!nt) {
err = -ENOMEM;
goto fail;
}
--
pw-bot: cr