[v1] i2c: designware: assert reset when error happen at ->probe()
diff mbox series

Message ID 20190819102423.73683-1-andriy.shevchenko@linux.intel.com
State Accepted
Headers show
Series
  • [v1] i2c: designware: assert reset when error happen at ->probe()
Related show

Commit Message

Andy Shevchenko Aug. 19, 2019, 10:24 a.m. UTC
The commit c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
introduced an optional clock while missed correct error handling.
assert reset line back if error happen at ->probe().

Fixes: c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
Cc: Phil Edworthy <phil.edworthy@renesas.com>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Jarkko Nikula Aug. 19, 2019, 1:56 p.m. UTC | #1
On 8/19/19 1:24 PM, Andy Shevchenko wrote:
> The commit c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
> introduced an optional clock while missed correct error handling.
> assert reset line back if error happen at ->probe().
> 
> Fixes: c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index ddfb81872906..4624ef8fbae8 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -346,8 +346,10 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
>   
>   	/* Optional interface clock */
>   	dev->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
> -	if (IS_ERR(dev->pclk))
> -		return PTR_ERR(dev->pclk);
> +	if (IS_ERR(dev->pclk)) {
> +		ret = PTR_ERR(dev->pclk);
> +		goto exit_reset;
> +	}
>   
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Wolfram Sang Aug. 29, 2019, 8:10 p.m. UTC | #2
On Mon, Aug 19, 2019 at 01:24:23PM +0300, Andy Shevchenko wrote:
> The commit c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
> introduced an optional clock while missed correct error handling.
> assert reset line back if error happen at ->probe().
> 
> Fixes: c62ebb3d5f0d ("i2c: designware: Add support for an interface clock")
> Cc: Phil Edworthy <phil.edworthy@renesas.com>
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied to for-next, thanks!

Patch
diff mbox series

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index ddfb81872906..4624ef8fbae8 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -346,8 +346,10 @@  static int dw_i2c_plat_probe(struct platform_device *pdev)
 
 	/* Optional interface clock */
 	dev->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
-	if (IS_ERR(dev->pclk))
-		return PTR_ERR(dev->pclk);
+	if (IS_ERR(dev->pclk)) {
+		ret = PTR_ERR(dev->pclk);
+		goto exit_reset;
+	}
 
 	dev->clk = devm_clk_get(&pdev->dev, NULL);
 	if (!i2c_dw_prepare_clk(dev, true)) {