Skip to contentSkip to conversation

PM / devfreq: tegra30: Add error message for devm_devfreq_add_device()

PATCH Applied Dmitry Osipenko 2 participants 2 messages Jun 30, 2022 – Jul 7, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PM / devfreq: tegra30: Add error message for devm_devfreq_add_device()

It's difficult to notice that driver failed to probe by looking at KMSG when devm_devfreq_add_device() fails. Add explicit error message for this case.

---
 drivers/devfreq/tegra30-devfreq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/devfreq/tegra30-devfreq.c +3 -1
index 30382bdfc655..f0d414b881e3 100644
@@ -926,8 +926,10 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 
 	devfreq = devm_devfreq_add_device(&pdev->dev, &tegra_devfreq_profile,
 					  "tegra_actmon", NULL);
-	if (IS_ERR(devfreq))
+	if (IS_ERR(devfreq)) {
+		dev_err(&pdev->dev, "Failed to add device: %pe\n", devfreq);
 		return PTR_ERR(devfreq);
+	}
 
 	return 0;
 }
Signature · 1 line
2.36.1
Applied
#1 lore raw
Quoted 15 lines · Dmitry Osipenko

It's difficult to notice that driver failed to probe by looking at KMSG when devm_devfreq_add_device() fails. Add explicit error message for this case.

---
 drivers/devfreq/tegra30-devfreq.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/devfreq/tegra30-devfreq.c +0 -0
index 30382bdfc655..f0d414b881e3 100644
@@ -926,8 +926,10 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
 

drivers/devfreq/tegra30-devfreq.c static int tegra_devfreq_probe(struct platform_device *pdev) · line 935

Quoted 10 lines
drivers/devfreq/tegra30-devfreq.c +3 -1
 	devfreq = devm_devfreq_add_device(&pdev->dev, &tegra_devfreq_profile,
 					  "tegra_actmon", NULL);
-	if (IS_ERR(devfreq))
+	if (IS_ERR(devfreq)) {
+		dev_err(&pdev->dev, "Failed to add device: %pe\n", devfreq);
 		return PTR_ERR(devfreq);
+	}
 
 	return 0;
 }

Applied it. Thanks.

Signature · 3 lines
Best Regards,
Samsung Electronics
Chanwoo Choi