* [PATCH] staging: iio: ad9834: add a check for devm_clk_get
@ 2019-10-16 14:25 Chuhong Yuan
2019-10-16 15:02 ` Dan Carpenter
2019-10-17 12:56 ` Ardelean, Alexandru
0 siblings, 2 replies; 4+ messages in thread
From: Chuhong Yuan @ 2019-10-16 14:25 UTC (permalink / raw)
Cc: Lars-Peter Clausen, Michael Hennerich, Stefan Popa,
Jonathan Cameron, Hartmut Knaack, Peter Meerwald-Stadler,
Greg Kroah-Hartman, linux-iio, devel, linux-kernel, Chuhong Yuan
ad9834_probe misses a check for devm_clk_get and may cause problems.
Add a check like what ad9832 does to fix it.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
---
drivers/staging/iio/frequency/ad9834.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 038d6732c3fd..23026978a5a5 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -417,6 +417,10 @@ static int ad9834_probe(struct spi_device *spi)
st = iio_priv(indio_dev);
mutex_init(&st->lock);
st->mclk = devm_clk_get(&spi->dev, NULL);
+ if (IS_ERR(st->mclk)) {
+ ret = PTR_ERR(st->mclk);
+ goto error_disable_reg;
+ }
ret = clk_prepare_enable(st->mclk);
if (ret) {
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: ad9834: add a check for devm_clk_get
2019-10-16 14:25 [PATCH] staging: iio: ad9834: add a check for devm_clk_get Chuhong Yuan
@ 2019-10-16 15:02 ` Dan Carpenter
2019-10-17 12:56 ` Ardelean, Alexandru
1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2019-10-16 15:02 UTC (permalink / raw)
To: Chuhong Yuan
Cc: devel, Lars-Peter Clausen, Stefan Popa, Michael Hennerich,
linux-iio, Greg Kroah-Hartman, linux-kernel,
Peter Meerwald-Stadler, Hartmut Knaack, Jonathan Cameron
On Wed, Oct 16, 2019 at 10:25:40PM +0800, Chuhong Yuan wrote:
> ad9834_probe misses a check for devm_clk_get and may cause problems.
> Add a check like what ad9832 does to fix it.
>
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Looks good.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: ad9834: add a check for devm_clk_get
2019-10-16 14:25 [PATCH] staging: iio: ad9834: add a check for devm_clk_get Chuhong Yuan
2019-10-16 15:02 ` Dan Carpenter
@ 2019-10-17 12:56 ` Ardelean, Alexandru
2019-10-18 19:10 ` Jonathan Cameron
1 sibling, 1 reply; 4+ messages in thread
From: Ardelean, Alexandru @ 2019-10-17 12:56 UTC (permalink / raw)
To: hslester96
Cc: Popa, Stefan Serban, gregkh, linux-iio, devel, jic23, lars,
Hennerich, Michael, pmeerw, knaack.h, linux-kernel
On Wed, 2019-10-16 at 22:25 +0800, Chuhong Yuan wrote:
> ad9834_probe misses a check for devm_clk_get and may cause problems.
> Add a check like what ad9832 does to fix it.
>
This could also use a Fixes tag, but not a big deal.
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> ---
> drivers/staging/iio/frequency/ad9834.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/staging/iio/frequency/ad9834.c
> b/drivers/staging/iio/frequency/ad9834.c
> index 038d6732c3fd..23026978a5a5 100644
> --- a/drivers/staging/iio/frequency/ad9834.c
> +++ b/drivers/staging/iio/frequency/ad9834.c
> @@ -417,6 +417,10 @@ static int ad9834_probe(struct spi_device *spi)
> st = iio_priv(indio_dev);
> mutex_init(&st->lock);
> st->mclk = devm_clk_get(&spi->dev, NULL);
> + if (IS_ERR(st->mclk)) {
> + ret = PTR_ERR(st->mclk);
> + goto error_disable_reg;
> + }
>
> ret = clk_prepare_enable(st->mclk);
> if (ret) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: iio: ad9834: add a check for devm_clk_get
2019-10-17 12:56 ` Ardelean, Alexandru
@ 2019-10-18 19:10 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2019-10-18 19:10 UTC (permalink / raw)
To: Ardelean, Alexandru
Cc: hslester96, Popa, Stefan Serban, gregkh, linux-iio, devel, lars,
Hennerich, Michael, pmeerw, knaack.h, linux-kernel
On Thu, 17 Oct 2019 12:56:33 +0000
"Ardelean, Alexandru" <alexandru.Ardelean@analog.com> wrote:
> On Wed, 2019-10-16 at 22:25 +0800, Chuhong Yuan wrote:
> > ad9834_probe misses a check for devm_clk_get and may cause problems.
> > Add a check like what ad9832 does to fix it.
> >
>
> This could also use a Fixes tag, but not a big deal.
>
> Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.
As a general point though, the fact that a devm error handler
actually has things to do suggests this code doesn't pass
the obviously correct test.
Nothing to do with this patch mind you!
Jonathan
>
> > Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
> > ---
> > drivers/staging/iio/frequency/ad9834.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/staging/iio/frequency/ad9834.c
> > b/drivers/staging/iio/frequency/ad9834.c
> > index 038d6732c3fd..23026978a5a5 100644
> > --- a/drivers/staging/iio/frequency/ad9834.c
> > +++ b/drivers/staging/iio/frequency/ad9834.c
> > @@ -417,6 +417,10 @@ static int ad9834_probe(struct spi_device *spi)
> > st = iio_priv(indio_dev);
> > mutex_init(&st->lock);
> > st->mclk = devm_clk_get(&spi->dev, NULL);
> > + if (IS_ERR(st->mclk)) {
> > + ret = PTR_ERR(st->mclk);
> > + goto error_disable_reg;
> > + }
> >
> > ret = clk_prepare_enable(st->mclk);
> > if (ret) {
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-18 19:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-16 14:25 [PATCH] staging: iio: ad9834: add a check for devm_clk_get Chuhong Yuan
2019-10-16 15:02 ` Dan Carpenter
2019-10-17 12:56 ` Ardelean, Alexandru
2019-10-18 19:10 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).