staging: iio: ad9834: add a check for devm_clk_get
authorChuhong Yuan <hslester96@gmail.com>
Wed, 16 Oct 2019 14:25:40 +0000 (22:25 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Fri, 18 Oct 2019 19:08:01 +0000 (20:08 +0100)
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>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/frequency/ad9834.c

index 038d6732c3fdbb15ee98c29e04cfef8c7a2091aa..23026978a5a5f5f12b42508551ab1d0b875127df 100644 (file)
@@ -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) {