gpio: sim: Initialize attribute allocated on the heap
PATCH 1/1 gpio: sim: Initialize attribute allocated on the heap
The attributes on the heap must be initialized before use. Neglecting that will produce an Oops in some configurations:
BUG: key ffff000800eba398 has not been registered!
Initialize attribute allocated on the heap.
Fixes 3f0279eb9e37 ("gpio: sim: new testing module")
Reported-by Naresh Kamboju <[email protected]>
Tested-by Naresh Kamboju <[email protected]>
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/gpio/gpio-sim.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/gpio-sim.c +1 -0
@@ -284,6 +284,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip) line_attr->offset = i; dev_attr = &line_attr->dev_attr; +sysfs_attr_init (&dev_attr->attr); dev_attr->attr.name =devm_kasprintf (dev,GFP_KERNEL ,"gpio%u" , i);
Signature · 1 line
2.30.2
Quoted 29 lines · Andy Shevchenko
The attributes on the heap must be initialized before use. Neglecting that will produce an Oops in some configurations:
BUG: key ffff000800eba398 has not been registered!Initialize attribute allocated on the heap.
Fixes 3f0279eb9e37 ("gpio: sim: new testing module")Reported-by Naresh Kamboju <[email protected]>Tested-by Naresh Kamboju <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>--- drivers/gpio/gpio-sim.c | 1 + 1 file changed, 1 insertion(+)drivers/gpio/gpio-sim.c +1
-1@@ -284,6 +284,7 @@ static int gpio_sim_setup_sysfs(struct gpio_sim_chip *chip) line_attr->offset = i; dev_attr = &line_attr->dev_attr; +sysfs_attr_init (&dev_attr->attr); dev_attr->attr.name =devm_kasprintf (dev,GFP_KERNEL ,"gpio%u" , i); --
Quoted 2 lines
2.30.2
So writing tests really serves a purpose, heh? :)
Thanks for the patch and QA Andy and Naresh, patch applied.
Bartosz