]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
regulator: da905{2,5}: Remove unnecessary array check
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 21 Sep 2018 00:04:20 +0000 (17:04 -0700)
committerMark Brown <broonie@kernel.org>
Fri, 21 Sep 2018 01:28:09 +0000 (18:28 -0700)
Clang warns that the address of a pointer will always evaluated as true
in a boolean context:

drivers/regulator/da9052-regulator.c:423:22: warning: address of array
'pdata->regulators' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (pdata && pdata->regulators) {
                  ~~ ~~~~~~~^~~~~~~~~~
drivers/regulator/da9055-regulator.c:615:22: warning: address of array
'pdata->regulators' will always evaluate to 'true'
[-Wpointer-bool-conversion]
        if (pdata && pdata->regulators) {
                  ~~ ~~~~~~~^~~~~~~~~~

Link: https://github.com/ClangBuiltLinux/linux/issues/142
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/da9052-regulator.c
drivers/regulator/da9055-regulator.c

index 9ececfef42d67326d1521b5ea1e23f2dfa593908..37e4025203e34949c42edeb09378caa06d7f4ddc 100644 (file)
@@ -420,7 +420,7 @@ static int da9052_regulator_probe(struct platform_device *pdev)
        config.dev = &pdev->dev;
        config.driver_data = regulator;
        config.regmap = da9052->regmap;
-       if (pdata && pdata->regulators) {
+       if (pdata) {
                config.init_data = pdata->regulators[cell->id];
        } else {
 #ifdef CONFIG_OF
index f40c3b8644ae524e2dbb76fb1c4a4af6d0d9fcd2..588c3d2445cf364c91cdcbb2c6376aaa095750ee 100644 (file)
@@ -612,7 +612,7 @@ static int da9055_regulator_probe(struct platform_device *pdev)
        config.driver_data = regulator;
        config.regmap = da9055->regmap;
 
-       if (pdata && pdata->regulators) {
+       if (pdata) {
                config.init_data = pdata->regulators[pdev->id];
        } else {
                ret = da9055_regulator_dt_init(pdev, regulator, &config,