mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 01:31:44 +00:00
cc27cce229
commit 84344b43c (ARM: i.MX5: Allow DT clock providers) introduce the following sparse warning: arch/arm/mach-imx/clk.c:12:43: warning: Using plain integer as NULL pointer There is no need to initialize phandle, so remove it. Cc: Martin Fuzzey <mfuzzey@parkeon.com> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
40 lines
808 B
C
40 lines
808 B
C
#include <linux/clk.h>
|
|
#include <linux/err.h>
|
|
#include <linux/of.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/spinlock.h>
|
|
#include "clk.h"
|
|
|
|
DEFINE_SPINLOCK(imx_ccm_lock);
|
|
|
|
static struct clk * __init imx_obtain_fixed_clock_from_dt(const char *name)
|
|
{
|
|
struct of_phandle_args phandle;
|
|
struct clk *clk = ERR_PTR(-ENODEV);
|
|
char *path;
|
|
|
|
path = kasprintf(GFP_KERNEL, "/clocks/%s", name);
|
|
if (!path)
|
|
return ERR_PTR(-ENOMEM);
|
|
|
|
phandle.np = of_find_node_by_path(path);
|
|
kfree(path);
|
|
|
|
if (phandle.np) {
|
|
clk = of_clk_get_from_provider(&phandle);
|
|
of_node_put(phandle.np);
|
|
}
|
|
return clk;
|
|
}
|
|
|
|
struct clk * __init imx_obtain_fixed_clock(
|
|
const char *name, unsigned long rate)
|
|
{
|
|
struct clk *clk;
|
|
|
|
clk = imx_obtain_fixed_clock_from_dt(name);
|
|
if (IS_ERR(clk))
|
|
clk = imx_clk_fixed(name, rate);
|
|
return clk;
|
|
}
|