linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: lightbar: Assign drvdata during probe
@ 2019-06-25 20:51 Rajat Jain
  2019-06-26 20:34 ` Enric Balletbo i Serra
  0 siblings, 1 reply; 3+ messages in thread
From: Rajat Jain @ 2019-06-25 20:51 UTC (permalink / raw)
  To: Benson Leung, Enric Balletbo i Serra, Guenter Roeck, linux-kernel
  Cc: evgreen, rajatxjain, Rajat Jain

The lightbar driver never assigned the drvdata in probe method, and thus
causes a panic when it is accessed at the suspend time.

Signed-off-by: Rajat Jain <rajatja@google.com>
---
 drivers/platform/chrome/cros_ec_lightbar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_lightbar.c b/drivers/platform/chrome/cros_ec_lightbar.c
index d30a6650b0b5..98e514fc5830 100644
--- a/drivers/platform/chrome/cros_ec_lightbar.c
+++ b/drivers/platform/chrome/cros_ec_lightbar.c
@@ -578,11 +578,14 @@ static int cros_ec_lightbar_probe(struct platform_device *pd)
 
 	ret = sysfs_create_group(&ec_dev->class_dev.kobj,
 				 &cros_ec_lightbar_attr_group);
-	if (ret < 0)
+	if (ret < 0) {
 		dev_err(dev, "failed to create %s attributes. err=%d\n",
 			cros_ec_lightbar_attr_group.name, ret);
+		return ret;
+	}
 
-	return ret;
+	platform_set_drvdata(pd, ec_dev);
+	return 0;
 }
 
 static int cros_ec_lightbar_remove(struct platform_device *pd)
-- 
2.22.0.410.gd8fdbe21b5-goog


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

end of thread, other threads:[~2019-06-27 21:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-25 20:51 [PATCH] platform/chrome: lightbar: Assign drvdata during probe Rajat Jain
2019-06-26 20:34 ` Enric Balletbo i Serra
2019-06-27 21:41   ` Rajat Jain

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).