[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6c77abb2-0b6f-a745-0950-0be34d41913e@samsung.com>
Date: Tue, 6 Apr 2021 08:17:09 +0200
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Alexandru Ardelean <aardelean@...iqon.com>,
linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Cc: jic23@...nel.org
Subject: Re: [PATCH] iio: buffer: use sysfs_attr_init() on allocated attrs
On 02.04.2021 19:42, Alexandru Ardelean wrote:
> When dynamically allocating sysfs attributes, it's a good idea to call
> sysfs_attr_init() on them to initialize lock_class_keys.
> This change does that.
>
> The lock_class_keys are set when the CONFIG_DEBUG_LOCK_ALLOC symbol is
> enabled. Which is [likely] one reason why I did not see this during
> development.
>
> I also am not able to see this even with CONFIG_DEBUG_LOCK_ALLOC enabled,
> so this may [likely] be reproduce-able on some system configurations.
>
> This was reported via:
> https://lore.kernel.org/linux-iio/CA+U=DsrsvGgXEF30-vXuXS_k=-mjSjiBwEEzwKb1hJVn1P98OA@mail.gmail.com/T/#u
>
> Fixes: 15097c7a1adc ("iio: buffer: wrap all buffer attributes into iio_dev_attr")
> Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Signed-off-by: Alexandru Ardelean <aardelean@...iqon.com>
> ---
>
> @Marek: could you maybe test this on your setup?
>
> I haven't been able to reproduce this on mine.
Works fine with this fix. Thanks!
Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Thanks
> Alex
>
> drivers/iio/industrialio-buffer.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iio/industrialio-buffer.c b/drivers/iio/industrialio-buffer.c
> index ee5aab9d4a23..06b2ea087408 100644
> --- a/drivers/iio/industrialio-buffer.c
> +++ b/drivers/iio/industrialio-buffer.c
> @@ -1309,6 +1309,7 @@ static struct attribute *iio_buffer_wrap_attr(struct iio_buffer *buffer,
> iio_attr->buffer = buffer;
> memcpy(&iio_attr->dev_attr, dattr, sizeof(iio_attr->dev_attr));
> iio_attr->dev_attr.attr.name = kstrdup_const(attr->name, GFP_KERNEL);
> + sysfs_attr_init(&iio_attr->dev_attr.attr);
>
> list_add(&iio_attr->l, &buffer->buffer_attr_list);
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
Powered by blists - more mailing lists