Commit 23faf631 authored by roel kluin's avatar roel kluin Committed by Grant Likely

powerpc/mpc5121: fix NULL test in mpc5121_clk_get utility function.

strcmp on NULL results in a segmentation fault, also, remove the second,
redundant test on dev
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
parent 5886188d
...@@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id) ...@@ -56,12 +56,12 @@ static struct clk *mpc5121_clk_get(struct device *dev, const char *id)
int dev_match = 0; int dev_match = 0;
int id_match = 0; int id_match = 0;
if (dev == NULL && id == NULL) if (dev == NULL || id == NULL)
return NULL; return NULL;
mutex_lock(&clocks_mutex); mutex_lock(&clocks_mutex);
list_for_each_entry(p, &clocks, node) { list_for_each_entry(p, &clocks, node) {
if (dev && dev == p->dev) if (dev == p->dev)
dev_match++; dev_match++;
if (strcmp(id, p->name) == 0) if (strcmp(id, p->name) == 0)
id_match++; id_match++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment