regulator: da9052: remove null pointer check on array pdata->regulators
PATCH 1/1 regulator: da9052: remove null pointer check on array pdata->regulators
From: Colin Ian King <[email protected]>
pdata->regulators is an array of DA9052_MAX_REGULATORS struct regulator_init_data pointers hence cannot be null, so the null pointer check on pdata->regulators is redundant. Remove it.
--- drivers/regulator/da9052-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/da9052-regulator.c +1 -1
@@ -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
Signature · 1 line
2.9.3
Mark Brown
maintainerdrivers/regulator/da9052-regulator.c static int da9052_regulator_probe(struct platform_device *pdev) · line 423
Quoted 6 lines · Colin King
pdata->regulatorsis an array ofDA9052_MAX_REGULATORSstructregulator_init_datapointers hence cannot be null, so the null pointer check onpdata->regulatorsis redundant. Remove it.drivers/regulator/da9052-regulator.c +1
-1-if (pdata && pdata->regulators) { +if (pdata) {
What is the benefit of this change? Due to the way C handles arrays and pointers one can't immediately tell without opening up the header file if regulators is a pointer to an array or an embedded array so it's more work to read and since this is the probe path it's unlikely to be a meaningful speed improvement even if the compiler doesn't figure it out at build time.