Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1365557 > unrolled thread

[PATCH] regulator: da9053: regulators is an array, so no need to check if NULL

Started byColin King <colin.king@canonical.com>
First post2016-03-28 17:50 +0200
Last post2016-03-29 19:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL Colin King <colin.king@canonical.com> - 2016-03-28 17:50 +0200
    Re: [PATCH] regulator: da9053: regulators is an array, so no need to  check if NULL Mark Brown <broonie@kernel.org> - 2016-03-29 19:10 +0200

#1365557 — [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL

FromColin King <colin.king@canonical.com>
Date2016-03-28 17:50 +0200
Subject[PATCH] regulator: da9053: regulators is an array, so no need to check if NULL
Message-ID<rhHAt-C5-13@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1366477 — Re: [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL

FromMark Brown <broonie@kernel.org>
Date2016-03-29 19:10 +0200
SubjectRe: [PATCH] regulator: da9053: regulators is an array, so no need to check if NULL
Message-ID<ri5js-TR-9@gated-at.bofh.it>
In reply to#1365557

[Multipart message — attachments visible in raw view] — view raw

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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web