diff mbox

cxl: Fix lockdep warning while creating afu_err_buff attribute

Message ID 1442977679-4468-1-git-send-email-vaibhav@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vaibhav Jain Sept. 23, 2015, 3:07 a.m. UTC
Presently a lockdep warning is reported during creation of afu_err_buff
bin_attribute for the afu. This is caused due to the variable attr.key
not pointing to a static class key, hence the function lockdep_init_map
reports this warning:

 BUG: key <some-address> not in .data!

The patch fixes this issue by calling sysfs_attr_init on the
attr_eb.attr structure before populating it with the afu_err_buff file
details. This will populate the attr.key variable with a static class
key so that lockdep_init_map stops complaining about the lockdep key not
being static.

Reported-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
---
 drivers/misc/cxl/sysfs.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ian Munsie Sept. 23, 2015, 3:20 a.m. UTC | #1
Thanks for fixing that Vaibhav :)

Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Daniel Axtens Sept. 23, 2015, 3:21 a.m. UTC | #2
Reviewed-by: Daniel Axtens <dja@axtens.net>

Thanks Vaibhav!

On Wed, 2015-09-23 at 08:37 +0530, Vaibhav Jain wrote:
> Presently a lockdep warning is reported during creation of afu_err_buff
> bin_attribute for the afu. This is caused due to the variable attr.key
> not pointing to a static class key, hence the function lockdep_init_map
> reports this warning:
> 
>  BUG: key <some-address> not in .data!
> 
> The patch fixes this issue by calling sysfs_attr_init on the
> attr_eb.attr structure before populating it with the afu_err_buff file
> details. This will populate the attr.key variable with a static class
> key so that lockdep_init_map stops complaining about the lockdep key not
> being static.
> 
> Reported-by: Daniel Axtens <dja@axtens.net>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> ---
>  drivers/misc/cxl/sysfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
> index 25868c2..02006f7 100644
> --- a/drivers/misc/cxl/sysfs.c
> +++ b/drivers/misc/cxl/sysfs.c
> @@ -592,6 +592,8 @@ int cxl_sysfs_afu_add(struct cxl_afu *afu)
>  
>  	/* conditionally create the add the binary file for error info buffer */
>  	if (afu->eb_len) {
> +		sysfs_attr_init(&afu->attr_eb.attr);
> +
>  		afu->attr_eb.attr.name = "afu_err_buff";
>  		afu->attr_eb.attr.mode = S_IRUGO;
>  		afu->attr_eb.size = afu->eb_len;
Michael Ellerman Sept. 25, 2015, 2:12 a.m. UTC | #3
On Wed, 2015-23-09 at 03:07:59 UTC, Vaibhav Jain wrote:
> Presently a lockdep warning is reported during creation of afu_err_buff
> bin_attribute for the afu. This is caused due to the variable attr.key
> not pointing to a static class key, hence the function lockdep_init_map
> reports this warning:
> 
>  BUG: key <some-address> not in .data!
> 
> The patch fixes this issue by calling sysfs_attr_init on the
> attr_eb.attr structure before populating it with the afu_err_buff file
> details. This will populate the attr.key variable with a static class
> key so that lockdep_init_map stops complaining about the lockdep key not
> being static.
> 
> Reported-by: Daniel Axtens <dja@axtens.net>
> Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
> Acked-by: Ian Munsie <imunsie@au1.ibm.com>
> Reviewed-by: Daniel Axtens <dja@axtens.net>

Applied to powerpc fixes, thanks.

https://git.kernel.org/powerpc/c/d6eb71a6d2eda21c8cd7a4dc

cheers
diff mbox

Patch

diff --git a/drivers/misc/cxl/sysfs.c b/drivers/misc/cxl/sysfs.c
index 25868c2..02006f7 100644
--- a/drivers/misc/cxl/sysfs.c
+++ b/drivers/misc/cxl/sysfs.c
@@ -592,6 +592,8 @@  int cxl_sysfs_afu_add(struct cxl_afu *afu)
 
 	/* conditionally create the add the binary file for error info buffer */
 	if (afu->eb_len) {
+		sysfs_attr_init(&afu->attr_eb.attr);
+
 		afu->attr_eb.attr.name = "afu_err_buff";
 		afu->attr_eb.attr.mode = S_IRUGO;
 		afu->attr_eb.size = afu->eb_len;