public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data
@ 2013-06-29 16:33 Axel Lin
  2013-07-01  0:01 ` jonghwa3.lee
  2013-07-01 10:16 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2013-06-29 16:33 UTC (permalink / raw)
  To: Mark Brown; +Cc: Jonghwa Lee, Myungjoo Ham, Liam Girdwood, linux-kernel

The implementation in of_regulator_match() already ensures match->init_data is
not NULL for all matched cases if the return value of of_regulator_match() > 0.

Thus remove NULL test for rmatch[i].init_data.

This patch also fixes the condition for loop iteration.
The for loop should iterate "matched" times rather than ARRAY_SIZE(regulators)
because we only allocate "matched" number of entries for rdata.
Though in most cases, "matched" == ARRAY_SIZE(regulators).

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/max77693.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
index d45a4dd..ce4b96c 100644
--- a/drivers/regulator/max77693.c
+++ b/drivers/regulator/max77693.c
@@ -190,9 +190,7 @@ static int max77693_pmic_dt_parse_rdata(struct device *dev,
 
 	tmp = *rdata;
 
-	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
-		if (!rmatch[i].init_data)
-			continue;
+	for (i = 0; i < matched; i++) {
 		tmp->initdata = rmatch[i].init_data;
 		tmp->of_node = rmatch[i].of_node;
 		tmp->id = regulators[i].id;
-- 
1.8.1.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data
  2013-06-29 16:33 [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data Axel Lin
@ 2013-07-01  0:01 ` jonghwa3.lee
  2013-07-01 10:16 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: jonghwa3.lee @ 2013-07-01  0:01 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, Jonghwa Lee, Myungjoo Ham, Liam Girdwood,
	linux-kernel

On 2013년 06월 30일 01:33, Axel Lin wrote:

> The implementation in of_regulator_match() already ensures match->init_data is
> not NULL for all matched cases if the return value of of_regulator_match() > 0.
> 
> Thus remove NULL test for rmatch[i].init_data.
> 
> This patch also fixes the condition for loop iteration.
> The for loop should iterate "matched" times rather than ARRAY_SIZE(regulators)
> because we only allocate "matched" number of entries for rdata.
> Though in most cases, "matched" == ARRAY_SIZE(regulators).
> 
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>  drivers/regulator/max77693.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/regulator/max77693.c b/drivers/regulator/max77693.c
> index d45a4dd..ce4b96c 100644
> --- a/drivers/regulator/max77693.c
> +++ b/drivers/regulator/max77693.c
> @@ -190,9 +190,7 @@ static int max77693_pmic_dt_parse_rdata(struct device *dev,
>  
>  	tmp = *rdata;
>  
> -	for (i = 0; i < ARRAY_SIZE(regulators); i++) {
> -		if (!rmatch[i].init_data)
> -			continue;
> +	for (i = 0; i < matched; i++) {
>  		tmp->initdata = rmatch[i].init_data;
>  		tmp->of_node = rmatch[i].of_node;
>  		tmp->id = regulators[i].id;


Looks good to me,

Acked-by : Jonghwa Lee <jonghwa3.lee@samsung.com>


Thanks,
Jonghwa

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data
  2013-06-29 16:33 [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data Axel Lin
  2013-07-01  0:01 ` jonghwa3.lee
@ 2013-07-01 10:16 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2013-07-01 10:16 UTC (permalink / raw)
  To: Axel Lin; +Cc: Jonghwa Lee, Myungjoo Ham, Liam Girdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

On Sun, Jun 30, 2013 at 12:33:52AM +0800, Axel Lin wrote:
> The implementation in of_regulator_match() already ensures match->init_data is
> not NULL for all matched cases if the return value of of_regulator_match() > 0.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-01 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-29 16:33 [PATCH] regulator: max77693: Remove NULL test for rmatch[i].init_data Axel Lin
2013-07-01  0:01 ` jonghwa3.lee
2013-07-01 10:16 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox