linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] gpio: sim: Initialize attribute allocated on the heap
@ 2021-04-08 15:55 Andy Shevchenko
  2021-04-09  8:10 ` Bartosz Golaszewski
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-04-08 15:55 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
  Cc: Linus Walleij, Naresh Kamboju

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 <naresh.kamboju@linaro.org>
Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-sim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index ea17289a869c..92493b98c51b 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-09  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-08 15:55 [PATCH v1 1/1] gpio: sim: Initialize attribute allocated on the heap Andy Shevchenko
2021-04-09  8:10 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).