All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources
@ 2018-01-12 11:38 Hans de Goede
  2018-01-12 13:04 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2018-01-12 11:38 UTC (permalink / raw)
  To: Thierry Reding, Andy Shevchenko; +Cc: Hans de Goede, linux-pwm

Some boards which do not use the pwm-controller have an empty or invalid
resource-table in ACPI the for pwm-controller. Currently this causes these
error messages to get logged:
[    3.281966] pwm-lpss 80862288:00: invalid resource
[    3.287098] pwm-lpss: probe of 80862288:00 failed with error -22

This commit silences these error messages on these boards by cleanly
exiting pwm_lpss_probe_platform() if there is no memory resource.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/pwm/pwm-lpss-platform.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c
index 5d6ed1507d29..5e5f4d018178 100644
--- a/drivers/pwm/pwm-lpss-platform.c
+++ b/drivers/pwm/pwm-lpss-platform.c
@@ -52,7 +52,14 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev)
 		return -ENODEV;
 
 	info = (const struct pwm_lpss_boardinfo *)id->driver_data;
+
+	/*
+	 * Some boards which don't use the pwm controller have an empty
+	 * resources table, so if we cannot get the resource, return -ENODEV.
+	 */
 	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!r)
+		return -ENODEV;
 
 	lpwm = pwm_lpss_probe(&pdev->dev, r, info);
 	if (IS_ERR(lpwm))
-- 
2.14.3

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

end of thread, other threads:[~2018-01-14 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-12 11:38 [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources Hans de Goede
2018-01-12 13:04 ` Andy Shevchenko
2018-01-14 19:58   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.