]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
regulator: pca9450: Correct probed name for PCA9452
authorPeng Fan <peng.fan@nxp.com>
Tue, 10 Mar 2026 04:25:53 +0000 (12:25 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 10 Mar 2026 14:52:42 +0000 (14:52 +0000)
An incorrect device name was logged for PCA9452 because the dev_info()
ternary omitted PCA9452 and fell through to "pca9450bc". Introduce a
type_name and set it per device type so the probed message matches the
actual PMIC. While here, make the PCA9451A case explicit.

No functional changes.

Fixes: 017b76fb8e5b6 ("regulator: pca9450: Add PMIC pca9452 support")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://patch.msgid.link/20260310-pca9450-irq-v1-2-36adf52c2c55@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/pca9450-regulator.c

index 2205f6de37e7d4eb8a0abf7deebf319395a2bc75..45d7dc44c2cd081a4ca570933a6284550f1d1402 100644 (file)
@@ -1293,6 +1293,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
        struct regulator_dev *ldo5;
        struct pca9450 *pca9450;
        unsigned int device_id, i;
+       const char *type_name;
        int ret;
 
        pca9450 = devm_kzalloc(&i2c->dev, sizeof(struct pca9450), GFP_KERNEL);
@@ -1303,15 +1304,22 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
        case PCA9450_TYPE_PCA9450A:
                regulator_desc = pca9450a_regulators;
                pca9450->rcnt = ARRAY_SIZE(pca9450a_regulators);
+               type_name = "pca9450a";
                break;
        case PCA9450_TYPE_PCA9450BC:
                regulator_desc = pca9450bc_regulators;
                pca9450->rcnt = ARRAY_SIZE(pca9450bc_regulators);
+               type_name = "pca9450bc";
                break;
        case PCA9450_TYPE_PCA9451A:
+               regulator_desc = pca9451a_regulators;
+               pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators);
+               type_name = "pca9451a";
+               break;
        case PCA9450_TYPE_PCA9452:
                regulator_desc = pca9451a_regulators;
                pca9450->rcnt = ARRAY_SIZE(pca9451a_regulators);
+               type_name = "pca9452";
                break;
        default:
                dev_err(&i2c->dev, "Unknown device type");
@@ -1413,9 +1421,7 @@ static int pca9450_i2c_probe(struct i2c_client *i2c)
                                          pca9450_i2c_restart_handler, pca9450))
                dev_warn(&i2c->dev, "Failed to register restart handler\n");
 
-       dev_info(&i2c->dev, "%s probed.\n",
-               type == PCA9450_TYPE_PCA9450A ? "pca9450a" :
-               (type == PCA9450_TYPE_PCA9451A ? "pca9451a" : "pca9450bc"));
+       dev_info(&i2c->dev, "%s probed.\n", type_name);
 
        return 0;
 }