aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2016-09-23 05:15:26 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-09-24 05:26:55 -0400
commit662786a5429c3a992c6f884a647ee32424822358 (patch)
tree2dfa5db7684e2d7b824fbb18bb83cdb1aaa5f08c
parent70121f7f3725c82e8927a4e03ca1d50c98bbc6d2 (diff)
i2c: axxia: disable clks in case of failure in probe
axxia_i2c_probe() does not disable clock in case of failure in i2c_add_adapter(). Also it ignores returned value from clk_prepare_enable(). Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
-rw-r--r--drivers/i2c/busses/i2c-axxia.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c
index d3bcaf4ab095..4351a9343058 100644
--- a/drivers/i2c/busses/i2c-axxia.c
+++ b/drivers/i2c/busses/i2c-axxia.c
@@ -545,7 +545,11 @@ static int axxia_i2c_probe(struct platform_device *pdev)
545 return ret; 545 return ret;
546 } 546 }
547 547
548 clk_prepare_enable(idev->i2c_clk); 548 ret = clk_prepare_enable(idev->i2c_clk);
549 if (ret) {
550 dev_err(&pdev->dev, "failed to enable clock\n");
551 return ret;
552 }
549 553
550 i2c_set_adapdata(&idev->adapter, idev); 554 i2c_set_adapdata(&idev->adapter, idev);
551 strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name)); 555 strlcpy(idev->adapter.name, pdev->name, sizeof(idev->adapter.name));
@@ -558,7 +562,13 @@ static int axxia_i2c_probe(struct platform_device *pdev)
558 562
559 platform_set_drvdata(pdev, idev); 563 platform_set_drvdata(pdev, idev);
560 564
561 return i2c_add_adapter(&idev->adapter); 565 ret = i2c_add_adapter(&idev->adapter);
566 if (ret) {
567 clk_disable_unprepare(idev->i2c_clk);
568 return ret;
569 }
570
571 return 0;
562} 572}
563 573
564static int axxia_i2c_remove(struct platform_device *pdev) 574static int axxia_i2c_remove(struct platform_device *pdev)