From: Hans de Goede <hdegoede@redhat.com>
To: Thierry Reding <thierry.reding@gmail.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>, linux-pwm@vger.kernel.org
Subject: [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources
Date: Fri, 12 Jan 2018 12:38:02 +0100 [thread overview]
Message-ID: <20180112113802.3888-1-hdegoede@redhat.com> (raw)
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
next reply other threads:[~2018-01-12 11:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 11:38 Hans de Goede [this message]
2018-01-12 13:04 ` [PATCH] pwm: lpss-platform: Cleanly exit probe on boards without resources Andy Shevchenko
2018-01-14 19:58 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180112113802.3888-1-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-pwm@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox