diff options
author | LABBE Corentin <clabbe.montjoie@gmail.com> | 2015-11-25 12:52:02 (GMT) |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2016-01-30 00:57:09 (GMT) |
commit | 8d0a69d735318cbd99c1376d16ed7ff82a7a678e (patch) | |
tree | 5ca448bddf64351d7b0cbbd66dc8f203d9199507 /drivers/clk/clk-palmas.c | |
parent | 93fffbbee11af1ff9658c2822cfd355b4f16243d (diff) | |
download | linux-8d0a69d735318cbd99c1376d16ed7ff82a7a678e.tar.xz |
clk: palmas: fix a possible NULL dereference
of_match_device could return NULL, and so cause a NULL pointer
dereference later.
Even if the probability of this case is very low, fixing it made
static analyzers happy.
Solving this with of_device_get_match_data made also code simplier.
Reported-by: coverity (CID 1324137)
Signed-off-by: LABBE Corentin <clabbe.montjoie@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk-palmas.c')
-rw-r--r-- | drivers/clk/clk-palmas.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/clk/clk-palmas.c b/drivers/clk/clk-palmas.c index c55e774..9c0b8e6 100644 --- a/drivers/clk/clk-palmas.c +++ b/drivers/clk/clk-palmas.c @@ -241,13 +241,13 @@ static int palmas_clks_probe(struct platform_device *pdev) struct palmas *palmas = dev_get_drvdata(pdev->dev.parent); struct device_node *node = pdev->dev.of_node; const struct palmas_clks_of_match_data *match_data; - const struct of_device_id *match; struct palmas_clock_info *cinfo; struct clk *clk; int ret; - match = of_match_device(palmas_clks_of_match, &pdev->dev); - match_data = match->data; + match_data = of_device_get_match_data(&pdev->dev); + if (!match_data) + return 1; cinfo = devm_kzalloc(&pdev->dev, sizeof(*cinfo), GFP_KERNEL); if (!cinfo) |