]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
i2c: sis96x: Replace dev_err() with dev_err_probe() in probe function
authorEnrico Zanda <e.zanda1@gmail.com>
Tue, 20 May 2025 19:43:59 +0000 (21:43 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 28 May 2026 22:05:06 +0000 (00:05 +0200)
This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250520194400.341079-10-e.zanda1@gmail.com
drivers/i2c/busses/i2c-sis96x.c

index 77529dda6fcde6acb29f3916d6564378f89bdc4c..eee41dc9d706c3f702065a26650b100a1a28caca 100644 (file)
@@ -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;
        }