Message ID | 20241104214310.6048-1-jiashengjiangcool@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/3] i2c: lpc2k: Add check for clk_enable() | expand |
Hi Jiasheng, On Mon, Nov 04, 2024 at 09:43:09PM +0000, Jiasheng Jiang wrote: > Add check for the return values of clk_enable() and clk_prepare_enable() > in order to catch the potential exceptions. > > Fixes: e7d48fa2b5fb ("[I2C] pxa: provide late suspend and early resume hooks") > Fixes: c3cef3f3c07b ("[ARM] pxa: update pxa i2c driver to use clk support") I don't think we need the fixes tag here and nowhere else in this series. > Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> > --- > drivers/i2c/busses/i2c-pxa.c | 14 ++++++++++++-- > 1 file changed, 12 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c > index 4d76e71cdd4b..1118a7f5c6bf 100644 > --- a/drivers/i2c/busses/i2c-pxa.c > +++ b/drivers/i2c/busses/i2c-pxa.c > @@ -1503,7 +1503,11 @@ static int i2c_pxa_probe(struct platform_device *dev) > i2c->adap.name); > } > > - clk_prepare_enable(i2c->clk); > + ret = clk_prepare_enable(i2c->clk); > + if (ret) { > + dev_err(&dev->dev, "failed to enable clock: %d\n", ret); please use dev_err_probe here. Thanks for your patch. Andi
Hi Andi, On Tue, Nov 5, 2024 at 9:13 AM Andi Shyti <andi.shyti@kernel.org> wrote: > > Add check for the return values of clk_enable() and clk_prepare_enable() > > in order to catch the potential exceptions. > > > > Fixes: e7d48fa2b5fb ("[I2C] pxa: provide late suspend and early resume hooks") > > Fixes: c3cef3f3c07b ("[ARM] pxa: update pxa i2c driver to use clk support") > > I don't think we need the fixes tag here and nowhere else in this > series. > > > Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> > > --- > > drivers/i2c/busses/i2c-pxa.c | 14 ++++++++++++-- > > 1 file changed, 12 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c > > index 4d76e71cdd4b..1118a7f5c6bf 100644 > > --- a/drivers/i2c/busses/i2c-pxa.c > > +++ b/drivers/i2c/busses/i2c-pxa.c > > @@ -1503,7 +1503,11 @@ static int i2c_pxa_probe(struct platform_device *dev) > > i2c->adap.name); > > } > > > > - clk_prepare_enable(i2c->clk); > > + ret = clk_prepare_enable(i2c->clk); > > + if (ret) { > > + dev_err(&dev->dev, "failed to enable clock: %d\n", ret); > > please use dev_err_probe here. Thanks, I have submitted a v2 series without the above problems. -Jiasheng
diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index 9fb33cbf7419..ea9831f34cd6 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -442,8 +442,14 @@ static int i2c_lpc2k_suspend(struct device *dev) static int i2c_lpc2k_resume(struct device *dev) { struct lpc2k_i2c *i2c = dev_get_drvdata(dev); + int ret; + + ret = clk_enable(i2c->clk); + if (ret) { + dev_err(dev, "failed to enable clock: %d\n", ret); + return ret; + } - clk_enable(i2c->clk); i2c_lpc2k_reset(i2c); return 0;
Add check for the return value of clk_enable() in order to catch the potential exception. Fixes: 3f9c37a0c9a5 ("i2c: lpc2k: add driver") Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com> --- drivers/i2c/busses/i2c-lpc2k.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)