Skip to content

Commit

Permalink
of: Minor simplification for the of_parse_phandles_with_args()
Browse files Browse the repository at this point in the history
By using 'list++' in the beginning we can simplify the code a
little bit.

Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Anton Vorontsov authored and Paul Mackerras committed Dec 21, 2008
1 parent c280266 commit c1bb7c6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/of/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,12 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
const u32 *cells;
const phandle *phandle;

phandle = list;
args = list + 1;
phandle = list++;
args = list;

/* one cell hole in the list = <>; */
if (!*phandle) {
list++;
if (!*phandle)
goto next;
}

node = of_find_node_by_phandle(*phandle);
if (!node) {
Expand All @@ -570,8 +568,7 @@ int of_parse_phandles_with_args(struct device_node *np, const char *list_name,
goto err1;
}

/* Next phandle is at offset of one phandle cell + #cells */
list += 1 + *cells;
list += *cells;
if (list > list_end) {
pr_debug("%s: insufficient arguments length\n",
np->full_name);
Expand Down

0 comments on commit c1bb7c6

Please sign in to comment.