Commit 13369194 authored by Dan Carpenter's avatar Dan Carpenter Committed by Eduardo Valentin

thermal: ti-soc-thermal: clean up the error handling a bit

We don't need to initialize "ret".  We can move the IS_ERR() checks into
the if condition instead of doing an assignment first.  Also there is a
check for "ret" when we know it is zero so we can remove that.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 8255e4e2
...@@ -1265,7 +1265,7 @@ static ...@@ -1265,7 +1265,7 @@ static
int ti_bandgap_probe(struct platform_device *pdev) int ti_bandgap_probe(struct platform_device *pdev)
{ {
struct ti_bandgap *bgp; struct ti_bandgap *bgp;
int clk_rate, ret = 0, i; int clk_rate, ret, i;
bgp = ti_bandgap_build(pdev); bgp = ti_bandgap_build(pdev);
if (IS_ERR(bgp)) { if (IS_ERR(bgp)) {
...@@ -1288,16 +1288,14 @@ int ti_bandgap_probe(struct platform_device *pdev) ...@@ -1288,16 +1288,14 @@ int ti_bandgap_probe(struct platform_device *pdev)
} }
bgp->fclock = clk_get(NULL, bgp->conf->fclock_name); bgp->fclock = clk_get(NULL, bgp->conf->fclock_name);
ret = IS_ERR(bgp->fclock); if (IS_ERR(bgp->fclock)) {
if (ret) {
dev_err(&pdev->dev, "failed to request fclock reference\n"); dev_err(&pdev->dev, "failed to request fclock reference\n");
ret = PTR_ERR(bgp->fclock); ret = PTR_ERR(bgp->fclock);
goto free_irqs; goto free_irqs;
} }
bgp->div_clk = clk_get(NULL, bgp->conf->div_ck_name); bgp->div_clk = clk_get(NULL, bgp->conf->div_ck_name);
ret = IS_ERR(bgp->div_clk); if (IS_ERR(bgp->div_clk)) {
if (ret) {
dev_err(&pdev->dev, "failed to request div_ts_ck clock ref\n"); dev_err(&pdev->dev, "failed to request div_ts_ck clock ref\n");
ret = PTR_ERR(bgp->div_clk); ret = PTR_ERR(bgp->div_clk);
goto free_irqs; goto free_irqs;
...@@ -1314,7 +1312,7 @@ int ti_bandgap_probe(struct platform_device *pdev) ...@@ -1314,7 +1312,7 @@ int ti_bandgap_probe(struct platform_device *pdev)
* may not be accurate * may not be accurate
*/ */
val = ti_bandgap_readl(bgp, tsr->bgap_efuse); val = ti_bandgap_readl(bgp, tsr->bgap_efuse);
if (ret || !val) if (!val)
dev_info(&pdev->dev, dev_info(&pdev->dev,
"Non-trimmed BGAP, Temp not accurate\n"); "Non-trimmed BGAP, Temp not accurate\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment