Skip to content

Commit

Permalink
cpufreq: apple-soc: Fix an IS_ERR() vs NULL check
Browse files Browse the repository at this point in the history
The of_iomap() function returns NULL if it fails.  It never returns
error pointers.  Fix the check accordingly.

Fixes: 6286bbb ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Dan Carpenter authored and Rafael J. Wysocki committed Mar 1, 2023
1 parent 5bd289f commit f435236
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cpufreq/apple-soc-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ static int apple_soc_cpufreq_find_cluster(struct cpufreq_policy *policy,
*info = match->data;

*reg_base = of_iomap(args.np, 0);
if (IS_ERR(*reg_base))
return PTR_ERR(*reg_base);
if (!*reg_base)
return -ENOMEM;

return 0;
}
Expand Down

0 comments on commit f435236

Please sign in to comment.