Re: [PATCH net-next v2 11/11] devlink: convert most of devlink_fmsg_*() to return void

From: Simon Horman
Date: Wed Oct 18 2023 - 12:11:06 EST


On Tue, Oct 17, 2023 at 12:53:41PM +0200, Przemek Kitszel wrote:

...

> diff --git a/net/devlink/health.c b/net/devlink/health.c
> index 3858a436598e..f4a6de576b6c 100644
> --- a/net/devlink/health.c
> +++ b/net/devlink/health.c
> @@ -566,17 +566,15 @@ static int devlink_health_do_dump(struct devlink_health_reporter *reporter,
> if (!reporter->dump_fmsg)
> return -ENOMEM;
>
> - err = devlink_fmsg_obj_nest_start(reporter->dump_fmsg);
> - if (err)
> - goto dump_err;
> + devlink_fmsg_obj_nest_start(reporter->dump_fmsg);
>
> err = reporter->ops->dump(reporter, reporter->dump_fmsg,
> priv_ctx, extack);
> if (err)
> goto dump_err;
>
> - err = devlink_fmsg_obj_nest_end(reporter->dump_fmsg);
> - if (err)
> + devlink_fmsg_obj_nest_end(reporter->dump_fmsg);
> + if (reporter->dump_fmsg->err)

Hi Przemek,

Smatch warns that err is not set to an error value here.

> goto dump_err;
>
> reporter->dump_ts = jiffies;

...