Re: [RFC PATCH v4 1/2] devres: Provide new helper for devm functions

From: Geert Uytterhoeven
Date: Thu Feb 27 2020 - 08:28:51 EST


Hi Marc,

On Wed, Feb 26, 2020 at 4:55 PM Marc Gonzalez <marc.w.gonzalez@xxxxxxx> wrote:
> Provide a simple wrapper for devres_alloc / devres_add.
>
> Signed-off-by: Marc Gonzalez <marc.w.gonzalez@xxxxxxx>

With the grammar fixed, as per below:
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

> --- a/drivers/base/devres.c
> +++ b/drivers/base/devres.c
> @@ -685,6 +685,34 @@ int devres_release_group(struct device *dev, void *id)
> }
> EXPORT_SYMBOL_GPL(devres_release_group);
>
> +/**
> + * devm_add - allocate and register new device resource
> + * @dev: device to add resource to
> + * @func: resource release function
> + * @arg: resource data
> + * @size: resource data size
> + *
> + * Simple wrapper for devres_alloc / devres_add.
> + * Release the resource if the allocation fails.

Releases ... failed.

> + *
> + * RETURNS:
> + * 0 if the allocation succeeds, -ENOMEM otherwise.

"0 on success" would avoid any discussion about "succeeds" or "succeeded" ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds