diff mbox series

[03/10] i2c: via: Replace dev_err() with dev_err_probe() in probe function

Message ID 20250415183447.396277-4-e.zanda1@gmail.com
State New
Headers show
Series i2c: Replace dev_err() with dev_err_probe() | expand

Commit Message

Enrico Zanda April 15, 2025, 6:34 p.m. UTC
This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-via.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

Comments

Andi Shyti April 16, 2025, 8:44 p.m. UTC | #1
Hi Enrico,

> @@ -89,10 +89,9 @@ static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
>  	u8 rev;
>  	int res;
>  
> -	if (pm_io_base) {
> -		dev_err(&dev->dev, "i2c-via: Will only support one host\n");
> -		return -ENODEV;
> -	}
> +	if (pm_io_base)
> +		return dev_err_probe(&dev->dev, -ENODEV,
> +				     "i2c-via: Will only support one host\n");

as we are here, you can remove the "i2c-via" because dev_err
already prints the device and I don't see any useful information
coming from it.

Thanks,
Andi
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 7ed29992a97f..2de73fda6613 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -89,10 +89,9 @@  static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	u8 rev;
 	int res;
 
-	if (pm_io_base) {
-		dev_err(&dev->dev, "i2c-via: Will only support one host\n");
-		return -ENODEV;
-	}
+	if (pm_io_base)
+		return dev_err_probe(&dev->dev, -ENODEV,
+				     "i2c-via: Will only support one host\n");
 
 	pci_read_config_byte(dev, PM_CFG_REVID, &rev);
 
@@ -113,10 +112,10 @@  static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	pci_read_config_word(dev, base, &pm_io_base);
 	pm_io_base &= (0xff << 8);
 
-	if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name)) {
-		dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE);
-		return -ENODEV;
-	}
+	if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name))
+		return dev_err_probe(&dev->dev, -ENODEV,
+				     "IO 0x%x-0x%x already in use\n",
+				     I2C_DIR, I2C_DIR + IOSPACE);
 
 	outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
 	outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);