Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1585049 > unrolled thread
| Started by | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| First post | 2017-02-21 06:20 +0100 |
| Last post | 2017-02-21 18:50 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] regulator: remove unnecessary code "Gustavo A. R. Silva" <garsilva@embeddedor.com> - 2017-02-21 06:20 +0100
Re: [PATCH] regulator: remove unnecessary code Mark Brown <broonie@kernel.org> - 2017-02-21 18:50 +0100
| From | "Gustavo A. R. Silva" <garsilva@embeddedor.com> |
|---|---|
| Date | 2017-02-21 06:20 +0100 |
| Subject | [PATCH] regulator: remove unnecessary code |
| Message-ID | <tdb1L-6o5-7@gated-at.bofh.it> |
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 <garsilva@embeddedor.com>
---
drivers/regulator/da9055-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/da9055-regulator.c b/drivers/regulator/da9055-regulator.c
index d029c94..a118f63 100644
--- a/drivers/regulator/da9055-regulator.c
+++ b/drivers/regulator/da9055-regulator.c
@@ -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,
--
2.5.0
[toc] | [next] | [standalone]
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Date | 2017-02-21 18:50 +0100 |
| Message-ID | <tdmJA-5Ph-15@gated-at.bofh.it> |
| In reply to | #1585049 |
[Multipart message — attachments visible in raw view] — view raw
On Mon, Feb 20, 2017 at 11:17:36PM -0600, Gustavo A. R. Silva wrote:
> 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.
> - 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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web