From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Yi Zhang <yizhang@marvell.com>, Chao Xie <chao.xie@marvell.com>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] regulator: 88pm800: Remove NULL test for regulator_unregister()
Date: Fri, 28 Jun 2013 21:34:14 +0800 [thread overview]
Message-ID: <1372426454.28529.3.camel@phoenix> (raw)
In-Reply-To: <1372426354.28529.1.camel@phoenix>
It's safe to call regulator_unregister with NULL.
In additional, having NULL check in the for loop is wrong because
the for loop exits if pm800_data->regulators[i] is NULL.
So we have have some regulators remains registered.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/88pm800.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c
index afa3762..1fc1899 100644
--- a/drivers/regulator/88pm800.c
+++ b/drivers/regulator/88pm800.c
@@ -405,7 +405,7 @@ static int pm800_regulator_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Failed to register %s\n",
info->desc.name);
- while (--i >= 0 && pm800_data->regulators[i])
+ while (--i >= 0)
regulator_unregister(pm800_data->regulators[i]);
return ret;
@@ -420,7 +420,7 @@ static int pm800_regulator_remove(struct platform_device *pdev)
struct pm800_regulators *pm800_data = platform_get_drvdata(pdev);
int i;
- for (i = 0; pm800_data->regulators[i] && i < PM800_ID_RG_MAX; i++)
+ for (i = 0; i < PM800_ID_RG_MAX; i++)
regulator_unregister(pm800_data->regulators[i]);
return 0;
--
1.8.1.2
next prev parent reply other threads:[~2013-06-28 13:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-28 13:32 [PATCH 1/2] regulator: 88pm800: Add missing config.of_node setting for regulator register Axel Lin
2013-06-28 13:34 ` Axel Lin [this message]
2013-06-28 13:50 ` Mark Brown
2013-07-01 2:14 ` Chao Xie
2013-07-01 8:46 ` Mark Brown
2013-07-01 8:46 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1372426454.28529.3.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=chao.xie@marvell.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yizhang@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.