Skip to contentSkip to conversation

iio: frequency: adf4350: Remove redundant null check before clk_disable_unprepare

PATCH In review Xu Wang 2 participants 2 messages Dec 18, 2020 – Dec 29, 2020

Subsystems (2)
lore
Share & tools
lore

Xu Wang

author
#0 lore raw

PATCH 1/1 iio: frequency: adf4350: Remove redundant null check before clk_disable_unprepare

Because clk_disable_unprepare() already checked NULL clock parameter, so the additional check is unnecessary, just remove it.

---
 drivers/iio/frequency/adf4350.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/frequency/adf4350.c +2 -4
index 82c050a3899d..1462a6a5bc6d 100644
@@ -582,8 +582,7 @@ static int adf4350_probe(struct spi_device *spi)
 	if (!IS_ERR(st->reg))
 		regulator_disable(st->reg);
 error_disable_clk:
-	if (clk)
-		clk_disable_unprepare(clk);
+	clk_disable_unprepare(clk);
 
 	return ret;
 }
@@ -599,8 +598,7 @@ static int adf4350_remove(struct spi_device *spi)
 
 	iio_device_unregister(indio_dev);
 
-	if (st->clk)
-		clk_disable_unprepare(st->clk);
+	clk_disable_unprepare(st->clk);
 
 	if (!IS_ERR(reg))
 		regulator_disable(reg);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · On Fri, 18 Dec 2020 09:46:47 +0000 Xu Wang <[email protected]> wrote:

Because clk_disable_unprepare() already checked NULL clock parameter, so the additional check is unnecessary, just remove it.

Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to see if they can find anything we missed.

Thanks,

Jonathan

Quoted 28 lines
---
 drivers/iio/frequency/adf4350.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/iio/frequency/adf4350.c +2 -4
index 82c050a3899d..1462a6a5bc6d 100644
@@ -582,8 +582,7 @@ static int adf4350_probe(struct spi_device *spi)
 	if (!IS_ERR(st->reg))
 		regulator_disable(st->reg);
 error_disable_clk:
-	if (clk)
-		clk_disable_unprepare(clk);
+	clk_disable_unprepare(clk);
 
 	return ret;
 }
@@ -599,8 +598,7 @@ static int adf4350_remove(struct spi_device *spi)
 
 	iio_device_unregister(indio_dev);
 
-	if (st->clk)
-		clk_disable_unprepare(st->clk);
+	clk_disable_unprepare(st->clk);
 
 	if (!IS_ERR(reg))
 		regulator_disable(reg);