]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mfd: sec-core: Return gracefully instead of BUG() if device cannot match
authorKrzysztof Kozlowski <krzk@kernel.org>
Tue, 29 Jan 2019 11:25:53 +0000 (12:25 +0100)
committerLee Jones <lee.jones@linaro.org>
Thu, 7 Feb 2019 10:43:15 +0000 (10:43 +0000)
Replace impossible BUG() in probe with a proper return.  This can be
triggered only in case of a clear bug (e.g. adding broken half-support
for new S2MPSXX flavor) but BUG() is discouraged and the boot process
can actually try to continue.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/sec-core.c

index e0835c9df7a197944f0373c0443a4f2eeffa4496..00321011de0a0e8647cc4704f9f6f5258a5b1716 100644 (file)
@@ -471,8 +471,9 @@ static int sec_pmic_probe(struct i2c_client *i2c,
                num_sec_devs = ARRAY_SIZE(s2mpu02_devs);
                break;
        default:
-               /* If this happens the probe function is problem */
-               BUG();
+               dev_err(&i2c->dev, "Unsupported device type (%lu)\n",
+                       sec_pmic->device_type);
+               return -ENODEV;
        }
        ret = devm_mfd_add_devices(sec_pmic->dev, -1, sec_devs, num_sec_devs,
                                   NULL, 0, NULL);