Message ID | 20200902150643.14839-6-krzk@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/9] i2c: stm32: Simplify with dev_err_probe() | expand |
On Wed, Sep 02, 2020 at 05:06:40PM +0200, Krzysztof Kozlowski wrote: > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Thanks Uwe
On Wed, Sep 02, 2020 at 05:06:40PM +0200, Krzysztof Kozlowski wrote: > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Oleksij Rempel <o.rempel@pengutronix.de> > --- > drivers/i2c/busses/i2c-imx.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c > index 0ab5381aa012..63f4367c312b 100644 > --- a/drivers/i2c/busses/i2c-imx.c > +++ b/drivers/i2c/busses/i2c-imx.c > @@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev) > > /* Get I2C clock */ > i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); > - if (IS_ERR(i2c_imx->clk)) { > - if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER) > - dev_err(&pdev->dev, "can't get I2C clock\n"); > - return PTR_ERR(i2c_imx->clk); > - } > + if (IS_ERR(i2c_imx->clk)) > + return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk), > + "can't get I2C clock\n"); > > ret = clk_prepare_enable(i2c_imx->clk); > if (ret) { > -- > 2.17.1 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel >
On Wed, Sep 02, 2020 at 05:06:40PM +0200, Krzysztof Kozlowski wrote: > Common pattern of handling deferred probe can be simplified with > dev_err_probe(). Less code and the error value gets printed. > > Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Thanks, but this patch was a bit earlier: http://patchwork.ozlabs.org/project/linux-i2c/patch/1597203954-1803-1-git-send-email-Anson.Huang@nxp.com/
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 0ab5381aa012..63f4367c312b 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1159,11 +1159,9 @@ static int i2c_imx_probe(struct platform_device *pdev) /* Get I2C clock */ i2c_imx->clk = devm_clk_get(&pdev->dev, NULL); - if (IS_ERR(i2c_imx->clk)) { - if (PTR_ERR(i2c_imx->clk) != -EPROBE_DEFER) - dev_err(&pdev->dev, "can't get I2C clock\n"); - return PTR_ERR(i2c_imx->clk); - } + if (IS_ERR(i2c_imx->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(i2c_imx->clk), + "can't get I2C clock\n"); ret = clk_prepare_enable(i2c_imx->clk); if (ret) {
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> --- drivers/i2c/busses/i2c-imx.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)