Commit 9baf3220 authored by Mark Brown's avatar Mark Brown Committed by Greg Kroah-Hartman

extcon: Ensure dynamically allocated sysfs attributes are initialised

The operation of lockdep requires that all dynamically allocated sysfs
nodes are initialised using sysfs_attr_init() otherwise lots of warnings
are generated. Ensure that all the dynamically allocated attributes that
extcon generates have this done.
Signed-off-by: default avatarMark Brown <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 1508d811
......@@ -30,6 +30,7 @@
#include <linux/err.h>
#include <linux/extcon.h>
#include <linux/slab.h>
#include <linux/sysfs.h>
* extcon_cable_name suggests the standard cable names for commonly used
......@@ -673,10 +674,12 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
cable-> = str;
cable->attr_g.attrs = cable->attrs;
cable-> = "name";
cable->attr_name.attr.mode = 0444;
cable-> = cable_name_show;
cable-> = "state";
cable->attr_state.attr.mode = 0644;
cable-> = cable_state_show;
......@@ -722,6 +725,7 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
goto err_muex;
strcpy(name, buf);
edev->d_attrs_muex[index] = name;
edev->d_attrs_muex[index].attr.mode = 0000;
edev->attrs_muex[index] = &edev->d_attrs_muex[index]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment