regulator: max77693: Remove NULL test for rmatch[i].init_data
authorAxel Lin <axel.lin@ingics.com>
Sat, 29 Jun 2013 16:33:52 +0000 (00:33 +0800)
committerMark Brown <broonie@linaro.org>
Mon, 1 Jul 2013 10:16:15 +0000 (11:16 +0100)
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>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
drivers/regulator/max77693.c

index d45a4dd171315e6d1da23495b79cf5731fed6a61..ce4b96c15ebaaf37cb26daa2d4a51df68d1e31e3 100644 (file)
@@ -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;