]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
i2c: sis630: Replace dev_err() with dev_err_probe() in probe function
authorEnrico Zanda <e.zanda1@gmail.com>
Tue, 20 May 2025 19:44:00 +0000 (21:44 +0200)
committerAndi Shyti <andi.shyti@kernel.org>
Thu, 28 May 2026 22:05:10 +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-11-e.zanda1@gmail.com
drivers/i2c/busses/i2c-sis630.c

index a19c3d251804d5a8e00ee36f1e7bfba4f66529f4..3d0638c2bc5140a3b1d983ecdaadc25c36bd1a65 100644 (file)
@@ -431,24 +431,23 @@ static int sis630_setup(struct pci_dev *sis630_dev)
           in acpi io space and read acpi base addr
        */
        if (pci_read_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, &b)) {
-               dev_err(&sis630_dev->dev, "Error: Can't read bios ctl reg\n");
-               retval = -ENODEV;
+               retval = dev_err_probe(&sis630_dev->dev, -ENODEV,
+                                      "Error: Can't read bios ctl reg\n");
                goto exit;
        }
        /* if ACPI already enabled , do nothing */
        if (!(b & 0x80) &&
            pci_write_config_byte(sis630_dev, SIS630_BIOS_CTL_REG, b | 0x80)) {
-               dev_err(&sis630_dev->dev, "Error: Can't enable ACPI\n");
-               retval = -ENODEV;
+               retval = dev_err_probe(&sis630_dev->dev, -ENODEV,
+                                      "Error: Can't enable ACPI\n");
                goto exit;
        }
 
        /* Determine the ACPI base address */
        if (pci_read_config_word(sis630_dev,
                                 SIS630_ACPI_BASE_REG, &acpi_base)) {
-               dev_err(&sis630_dev->dev,
-                       "Error: Can't determine ACPI base address\n");
-               retval = -ENODEV;
+               retval = dev_err_probe(&sis630_dev->dev, -ENODEV,
+                                      "Error: Can't determine ACPI base address\n");
                goto exit;
        }
 
@@ -469,11 +468,10 @@ static int sis630_setup(struct pci_dev *sis630_dev)
        /* Everything is happy, let's grab the memory and set things up. */
        if (!request_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION,
                            sis630_driver.name)) {
-               dev_err(&sis630_dev->dev,
-                       "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
-                       smbus_base + SMB_STS,
-                       smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
-               retval = -EBUSY;
+               retval = dev_err_probe(&sis630_dev->dev, -EBUSY,
+                                      "I/O Region 0x%04x-0x%04x for SMBus already in use.\n",
+                                      smbus_base + SMB_STS,
+                                      smbus_base + SMB_STS + SIS630_SMB_IOREGION - 1);
                goto exit;
        }
 
@@ -511,12 +509,9 @@ static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
 {
        int ret;
 
-       if (sis630_setup(dev)) {
-               dev_err(&dev->dev,
-                       "SIS630 compatible bus not detected, "
-                       "module not inserted.\n");
-               return -ENODEV;
-       }
+       if (sis630_setup(dev))
+               return dev_err_probe(&dev->dev, -ENODEV,
+                                    "Compatible bus not detected, module not inserted.\n");
 
        /* set up the sysfs linkage to our parent device */
        sis630_adapter.dev.parent = &dev->dev;