Message ID | 20240826051233.1937767-1-yanzhen@vivo.com |
---|---|
State | New |
Headers | show |
Series | [v1] clk: qcom: Fix error checking for devm_clk_hw_get_clk() | expand |
Le 26/08/2024 à 07:12, Yan Zhen a écrit : > The devm_clk_hw_get_clk() function returns error pointers. > It never returns NULL. Update the check accordingly. > > Signed-off-by: Yan Zhen <yanzhen@vivo.com> > --- > drivers/clk/qcom/common.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c > index 33cc1f73c69d..69c7876fac23 100644 > --- a/drivers/clk/qcom/common.c > +++ b/drivers/clk/qcom/common.c > @@ -273,7 +273,7 @@ static int qcom_cc_icc_register(struct device *dev, > icd[i].slave_id = desc->icc_hws[i].slave_id; > hws = &desc->clks[desc->icc_hws[i].clk_id]->hw; > icd[i].clk = devm_clk_hw_get_clk(dev, hws, "icc"); > - if (!icd[i].clk) > + if (IS_ERR(icd[i].clk)) > return dev_err_probe(dev, -ENOENT, Maybe return PTR_ERR(icd[i].clk) instead of -ENOENT? CJ > "(%d) clock entry is null\n", i); > icd[i].name = clk_hw_get_name(hws);
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index 33cc1f73c69d..69c7876fac23 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -273,7 +273,7 @@ static int qcom_cc_icc_register(struct device *dev, icd[i].slave_id = desc->icc_hws[i].slave_id; hws = &desc->clks[desc->icc_hws[i].clk_id]->hw; icd[i].clk = devm_clk_hw_get_clk(dev, hws, "icc"); - if (!icd[i].clk) + if (IS_ERR(icd[i].clk)) return dev_err_probe(dev, -ENOENT, "(%d) clock entry is null\n", i); icd[i].name = clk_hw_get_name(hws);
The devm_clk_hw_get_clk() function returns error pointers. It never returns NULL. Update the check accordingly. Signed-off-by: Yan Zhen <yanzhen@vivo.com> --- drivers/clk/qcom/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)