forked from Minki/linux
clk: ls1028a: fix a dereference of pointer 'parent' before a null check
Currently the pointer 'parent' is being dereferenced before it is
being null checked. Fix this by performing the null check before
it is dereferenced.
Addresses-Coverity: ("Dereference before null check")
Fixes: d37010a3c1
("clk: ls1028a: Add clock driver for Display output interface")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lkml.kernel.org/r/20200203223736.99645-1-colin.king@canonical.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
2a8aa18c11
commit
73cb3106e8
@ -187,7 +187,7 @@ static int plldig_init(struct clk_hw *hw)
|
|||||||
{
|
{
|
||||||
struct clk_plldig *data = to_clk_plldig(hw);
|
struct clk_plldig *data = to_clk_plldig(hw);
|
||||||
struct clk_hw *parent = clk_hw_get_parent(hw);
|
struct clk_hw *parent = clk_hw_get_parent(hw);
|
||||||
unsigned long parent_rate = clk_hw_get_rate(parent);
|
unsigned long parent_rate;
|
||||||
unsigned long val;
|
unsigned long val;
|
||||||
unsigned long long lltmp;
|
unsigned long long lltmp;
|
||||||
unsigned int mfd, fracdiv = 0;
|
unsigned int mfd, fracdiv = 0;
|
||||||
@ -195,6 +195,8 @@ static int plldig_init(struct clk_hw *hw)
|
|||||||
if (!parent)
|
if (!parent)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
parent_rate = clk_hw_get_rate(parent);
|
||||||
|
|
||||||
if (data->vco_freq) {
|
if (data->vco_freq) {
|
||||||
mfd = data->vco_freq / parent_rate;
|
mfd = data->vco_freq / parent_rate;
|
||||||
lltmp = data->vco_freq % parent_rate;
|
lltmp = data->vco_freq % parent_rate;
|
||||||
|
Loading…
Reference in New Issue
Block a user