mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maarten ter Huurne <maarten@treewalker.org>
To: Mark Brown <broonie@kernel.org>
Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>,
	linux-kernel@vger.kernel.org,
	Maarten ter Huurne <maarten@treewalker.org>
Subject: [PATCH v2 2/4] regulator: act8865: Remove "too many regulators" error handler
Date: Thu, 17 Mar 2016 15:05:06 +0100	[thread overview]
Message-ID: <1458223508-20740-2-git-send-email-maarten@treewalker.org> (raw)
In-Reply-To: <1458223508-20740-1-git-send-email-maarten@treewalker.org>

The check would dereference pdata, which can be NULL in the non-DT
use case.

Nothing will break if pdata->num_regulators is larger than the number
of regulators that the driver defines: pdata->num_regulators is only
read in act8865_get_init_data() to iterate through pdata->regulators.

The error handler might have some value as a sanity check on the
platform data, but the platform data could be broken in many other
ways that are not checked for (unknown IDs, duplicate IDs), so I see
no reason to perform only this specific check.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
---
 drivers/regulator/act8865-regulator.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c
index 89f856f..69cdad0 100644
--- a/drivers/regulator/act8865-regulator.c
+++ b/drivers/regulator/act8865-regulator.c
@@ -485,12 +485,6 @@ static int act8865_pmic_probe(struct i2c_client *client,
 		pdata = &pdata_of;
 	}
 
-	if (pdata->num_regulators > num_regulators) {
-		dev_err(dev, "too many regulators: %d\n",
-			pdata->num_regulators);
-		return -EINVAL;
-	}
-
 	act8865 = devm_kzalloc(dev, sizeof(struct act8865), GFP_KERNEL);
 	if (!act8865)
 		return -ENOMEM;
-- 
2.6.2

  reply	other threads:[~2016-03-17 14:05 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-17 14:05 [PATCH v2 1/4] regulator: act8865: Remove redundant dev lookups Maarten ter Huurne
2016-03-17 14:05 ` Maarten ter Huurne [this message]
2016-03-23 13:43   ` Applied "regulator: act8865: Remove "too many regulators" error handler" to the regulator tree Mark Brown
2016-03-17 14:05 ` [PATCH v2 3/4] regulator: act8865: Pass of_node via act8865_regulator_data Maarten ter Huurne
2016-03-28 19:35   ` Mark Brown
2016-03-17 14:05 ` [PATCH v2 4/4] regulator: act8865: Configure register access for act8600 Maarten ter Huurne
2016-03-23 13:43 ` Applied "regulator: act8865: Remove redundant dev lookups" to the regulator tree 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=1458223508-20740-2-git-send-email-maarten@treewalker.org \
    --to=maarten@treewalker.org \
    --cc=Zubair.Kakakhel@imgtec.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 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®