Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: frequency: adf4350: disable reg and clk on error in adf4350_probe()

Disable reg and clk when devm_gpiod_get_optional() fails in adf4350_probe().

Fixes:4a89d2f47ccd ("iio: adf4350: Convert to use GPIO descriptor")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210601142605.3613605-1-yangyingliang@huawei.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Yang Yingliang and committed by
Jonathan Cameron
c8cc4cf6 8090d674

+4 -2
+4 -2
drivers/iio/frequency/adf4350.c
··· 563 563 564 564 st->lock_detect_gpiod = devm_gpiod_get_optional(&spi->dev, NULL, 565 565 GPIOD_IN); 566 - if (IS_ERR(st->lock_detect_gpiod)) 567 - return PTR_ERR(st->lock_detect_gpiod); 566 + if (IS_ERR(st->lock_detect_gpiod)) { 567 + ret = PTR_ERR(st->lock_detect_gpiod); 568 + goto error_disable_reg; 569 + } 568 570 569 571 if (pdata->power_up_frequency) { 570 572 ret = adf4350_set_freq(st, pdata->power_up_frequency);