regulator: remove unnecessary code
PATCH 1/1 regulator: remove unnecessary code
The name of an array used by itself will always return the array's address. So it makes no sense to evaluate it, since the test will always evaluate as true.
Addresses-Coverity-ID: 751412
Signed-off-by Gustavo A. R. Silva <[email protected]>
--- drivers/regulator/da9055-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/da9055-regulator.c +1 -1
@@ -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,
Signature · 1 line
2.5.0
Mark Brown
maintainerdrivers/regulator/da9055-regulator.c static int da9055_regulator_probe(struct platform_device *pdev) · line 615
Quoted 6 lines · Gustavo A. R. Silva
The name of an array used by itself will always return the array's address. So it makes no sense to evaluate it, since the test will always evaluate as true.
drivers/regulator/da9055-regulator.c +1
-1-if (pdata && pdata->regulators) { +if (pdata) {
This isn't actually helping anything, it just makes the code potentially less robust if someone changes regulators to be allocated separately. There's no cost to having the check in the code, the compiler should notice if it's always true.