Re: [PATCH v13 02/18] EDAC: Add scrub control feature

Jonathan Cameron
2024-10-14T14:26:30Z

On Wed, 9 Oct 2024 13:41:03 +0100
<shiju.jose@huawei.com> wrote:

> From: Shiju Jose <shiju.jose@huawei.com>
>
> Add generic EDAC scrub control in order to control the memory scrubbers
> in the system. The device with scrub feature registers with EDAC device
> driver, which retrieves the scrub descriptor from EDAC scrub driver and
> expose the sysfs scrub control attributes for a scrub instance to userspace
> in /sys/bus/edac/devices/<dev-name>/scrubX/.
>
> The common sysfs scrub control interface abstracts the control of an
> arbitrary scrubbing functionality to a common set of functions.
> The sysfs scrub attribute nodes would be present only if the client driver
> has implemented the corresponding attribute callback function and passed
> in ops to the EDAC device driver during registration.
>
> Co-developed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Shiju Jose <shiju.jose@huawei.com>

One follow on comment. Otherwise LGTM and the new macros definitely help on
reducing code. (I'm not normally fan of macros at the function
level, but here I'm convinced)

>
> @@ -657,17 +686,19 @@ int edac_dev_register(struct device *parent, char *name,
>
> ret = dev_set_name(&ctx->dev, name);
> if (ret)
> - goto groups_free;
> + goto data_mem_free;
>
> ret = device_register(&ctx->dev);
> if (ret) {
> put_device(&ctx->dev);
> - goto groups_free;
> + goto data_mem_free;
As in previous patch I think this goto is incorrect and should be dropped.
> return ret;
> }
>
> return devm_add_action_or_reset(parent, edac_dev_unreg, &ctx->dev);
>
> +data_mem_free:
> + kfree(ctx->scrub);
> groups_free:
> kfree(ras_attr_groups);