* [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL
@ 2016-03-28 15:41 Colin King
2016-03-29 17:01 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2016-03-28 15:41 UTC (permalink / raw)
To: Support Opensource, Liam Girdwood, Mark Brown; +Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
pdata->regulators is an array, so can never be null, so the
null check on this array is redundant and can be removed.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/regulator/da9052-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 1050cb7..3a4361a 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -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
--
2.7.4
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL
2016-03-28 15:41 [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL Colin King
@ 2016-03-29 17:01 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2016-03-29 17:01 UTC (permalink / raw)
To: Colin King; +Cc: Support Opensource, Liam Girdwood, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 469 bytes --]
On Mon, Mar 28, 2016 at 04:41:43PM +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> pdata->regulators is an array, so can never be null, so the
> null check on this array is redundant and can be removed.
What is the value in this change? The check is always true so it will
be optimised away if the compiler is sensible but leaving it there means
that there's one less thing that can go wrong if the platform data is
changed.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-03-29 17:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 15:41 [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL Colin King
2016-03-29 17:01 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®