From: Raag Jadav <raag.jadav@intel.com>
To: u.kleine-koenig@pengutronix.de, jarkko.nikula@linux.intel.com,
mika.westerberg@linux.intel.com,
andriy.shevchenko@linux.intel.com, lakshmi.sowjanya.d@intel.com
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v3 4/5] pwm: dwc: simplify error handling
Date: Mon, 12 Feb 2024 18:32:46 +0530 [thread overview]
Message-ID: <20240212130247.9985-5-raag.jadav@intel.com> (raw)
In-Reply-To: <20240212130247.9985-1-raag.jadav@intel.com>
Simplify error handling in ->probe() function using dev_err_probe() helper
and while at it, drop error codes from the message to prevent duplication.
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
drivers/pwm/pwm-dwc.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/pwm/pwm-dwc.c b/drivers/pwm/pwm-dwc.c
index 6d922afcb20a..56fac8655c7b 100644
--- a/drivers/pwm/pwm-dwc.c
+++ b/drivers/pwm/pwm-dwc.c
@@ -51,18 +51,14 @@ static int dwc_pwm_probe(struct pci_dev *pci, const struct pci_device_id *id)
int i, ret;
ret = pcim_enable_device(pci);
- if (ret) {
- dev_err(dev, "Failed to enable device (%pe)\n", ERR_PTR(ret));
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to enable device\n");
pci_set_master(pci);
ret = pcim_iomap_regions(pci, BIT(0), pci_name(pci));
- if (ret) {
- dev_err(dev, "Failed to iomap PCI BAR (%pe)\n", ERR_PTR(ret));
- return ret;
- }
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to iomap PCI BAR\n");
info = (const struct dwc_pwm_info *)id->driver_data;
--
2.35.3
next prev parent reply other threads:[~2024-02-12 13:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 13:02 [PATCH v3 0/5] DesignWare PWM improvements Raag Jadav
2024-02-12 13:02 ` [PATCH v3 1/5] pwm: dwc: use pm_sleep_ptr() macro Raag Jadav
2024-02-12 13:02 ` [PATCH v3 2/5] pwm: dwc: drop redundant error check Raag Jadav
2024-02-14 17:48 ` Uwe Kleine-König
2024-02-12 13:02 ` [PATCH v3 3/5] pwm: dwc: Add 16 channel support for Intel Elkhart Lake Raag Jadav
2024-02-12 13:02 ` Raag Jadav [this message]
2024-02-12 13:02 ` [PATCH v3 5/5] pwm: dwc: access driver_data using dev_get_drvdata() Raag Jadav
2024-02-14 12:55 ` [PATCH v3 0/5] DesignWare PWM improvements Jarkko Nikula
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=20240212130247.9985-5-raag.jadav@intel.com \
--to=raag.jadav@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=lakshmi.sowjanya.d@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=u.kleine-koenig@pengutronix.de \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).