Skip to content

Commit

Permalink
powerpc/mpc5121: fix NULL test in mpc5121_clk_get utility function.
Browse files Browse the repository at this point in the history
strcmp on NULL results in a segmentation fault, also, remove the second,
redundant test on dev

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
  • Loading branch information
roel kluin authored and Grant Likely committed Jan 9, 2009
1 parent 5886188 commit 23faf63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/512x/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
int dev_match = 0;
int id_match = 0;

if (dev == NULL && id == NULL)
if (dev == NULL || id == NULL)
return NULL;

mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) {
if (dev && dev == p->dev)
if (dev == p->dev)
dev_match++;
if (strcmp(id, p->name) == 0)
id_match++;
Expand Down

0 comments on commit 23faf63

Please sign in to comment.