From: Enrico Zanda <e.zanda1@gmail.com>
To: linux-i2c@vger.kernel.org
Cc: andi.shyti@kernel.org, Enrico Zanda <e.zanda1@gmail.com>
Subject: [PATCH 09/10] i2c: sis96x: Replace dev_err() with dev_err_probe() in probe function
Date: Tue, 20 May 2025 21:43:59 +0200 [thread overview]
Message-ID: <20250520194400.341079-10-e.zanda1@gmail.com> (raw)
In-Reply-To: <20250520194400.341079-1-e.zanda1@gmail.com>
This simplifies the code while improving log.
Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
drivers/i2c/busses/i2c-sis96x.c | 30 +++++++++++++-----------------
1 file changed, 13 insertions(+), 17 deletions(-)
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c
index 77529dda6fcd..eee41dc9d706 100644
--- a/drivers/i2c/busses/i2c-sis96x.c
+++ b/drivers/i2c/busses/i2c-sis96x.c
@@ -245,23 +245,19 @@ static int sis96x_probe(struct pci_dev *dev,
u16 ww = 0;
int retval;
- if (sis96x_smbus_base) {
- dev_err(&dev->dev, "Only one device supported.\n");
- return -EBUSY;
- }
+ if (sis96x_smbus_base)
+ return dev_err_probe(&dev->dev, -EBUSY, "Only one device supported.\n");
pci_read_config_word(dev, PCI_CLASS_DEVICE, &ww);
- if (PCI_CLASS_SERIAL_SMBUS != ww) {
- dev_err(&dev->dev, "Unsupported device class 0x%04x!\n", ww);
- return -ENODEV;
- }
+ if (ww != PCI_CLASS_SERIAL_SMBUS)
+ return dev_err_probe(&dev->dev, -ENODEV,
+ "Unsupported device class 0x%04x!\n", ww);
sis96x_smbus_base = pci_resource_start(dev, SIS96x_BAR);
- if (!sis96x_smbus_base) {
- dev_err(&dev->dev, "SiS96x SMBus base address "
- "not initialized!\n");
- return -EINVAL;
- }
+ if (!sis96x_smbus_base)
+ return dev_err_probe(&dev->dev, -EINVAL,
+ "SiS96x SMBus base address not initialized!\n");
+
dev_info(&dev->dev, "SiS96x SMBus base address: 0x%04x\n",
sis96x_smbus_base);
@@ -272,9 +268,9 @@ static int sis96x_probe(struct pci_dev *dev,
/* Everything is happy, let's grab the memory and set things up. */
if (!request_region(sis96x_smbus_base, SMB_IOSIZE,
sis96x_driver.name)) {
- dev_err(&dev->dev, "SMBus registers 0x%04x-0x%04x "
- "already in use!\n", sis96x_smbus_base,
- sis96x_smbus_base + SMB_IOSIZE - 1);
+ dev_err_probe(&dev->dev, -EINVAL,
+ "SMBus registers 0x%04x-0x%04x already in use!\n",
+ sis96x_smbus_base, sis96x_smbus_base + SMB_IOSIZE - 1);
sis96x_smbus_base = 0;
return -EINVAL;
@@ -287,7 +283,7 @@ static int sis96x_probe(struct pci_dev *dev,
"SiS96x SMBus adapter at 0x%04x", sis96x_smbus_base);
if ((retval = i2c_add_adapter(&sis96x_adapter))) {
- dev_err(&dev->dev, "Couldn't register adapter!\n");
+ dev_err_probe(&dev->dev, retval, "Couldn't register adapter!\n");
release_region(sis96x_smbus_base, SMB_IOSIZE);
sis96x_smbus_base = 0;
}
--
2.43.0
next prev parent reply other threads:[~2025-05-20 19:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 19:43 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
2025-05-20 19:43 ` [PATCH 01/10] i2c: tiny-usb: Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
2025-05-20 19:43 ` [PATCH 02/10] i2c: tegra: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 03/10] i2c: sun6i-p2wi: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 04/10] i2c: stm32f7: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 05/10] i2c: stm32f4: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 06/10] i2c: stm32: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 07/10] i2c: st: " Enrico Zanda
2025-05-20 19:43 ` [PATCH 08/10] i2c: sprd: " Enrico Zanda
2025-05-20 19:43 ` Enrico Zanda [this message]
2025-05-20 19:44 ` [PATCH 10/10] i2c: sis630: " Enrico Zanda
-- strict thread matches above, loose matches on Subject: below --
2026-03-24 18:26 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Atharv Dubey
2026-03-24 18:26 ` [PATCH 09/10] i2c: sis96x: Replace dev_err() with dev_err_probe() in probe function Atharv Dubey
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=20250520194400.341079-10-e.zanda1@gmail.com \
--to=e.zanda1@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=linux-i2c@vger.kernel.org \
/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