]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: atomisp: Put PMIC device after getting its I²C address
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 26 Mar 2024 20:27:02 +0000 (20:27 +0000)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 26 Apr 2024 09:23:12 +0000 (10:23 +0100)
We don't use the PMIC I²C client device after getting its address.
Drop the reference to it. We do not expect device to disappear
as it should be taken care by the OpRegion drivers.

Link: https://lore.kernel.org/r/20240326202813.1425431-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c

index 804ffff245f34cddcafbb3ec86c0e9636f447213..91c403128a4d40841a21b5043986d365a1040440 100644 (file)
@@ -497,16 +497,19 @@ static u8 gmin_get_pmic_id_and_addr(struct device *dev)
        if (pmic_id)
                return pmic_i2c_addr;
 
-       if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power))
+       if (gmin_i2c_dev_exists(dev, PMIC_ACPI_TI, &power)) {
                pmic_id = PMIC_TI;
-       else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power))
+       } else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_AXP, &power)) {
                pmic_id = PMIC_AXP;
-       else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power))
+       } else if (gmin_i2c_dev_exists(dev, PMIC_ACPI_CRYSTALCOVE, &power)) {
                pmic_id = PMIC_CRYSTALCOVE;
-       else
+       } else {
                pmic_id = PMIC_REGULATOR;
+               return 0;
+       }
 
-       pmic_i2c_addr = power ? power->addr : 0;
+       pmic_i2c_addr = power->addr;
+       put_device(&power->dev);
        return pmic_i2c_addr;
 }