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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: stm32-adc: Remove redundant null check before clk_prepare_enable/clk_disable_unprepare

Because clk_prepare_enable() and clk_disable_unprepare() already checked
NULL clock parameter, so the additional checks are unnecessary, just
remove them.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
Acked-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20201218093512.871-1-vulab@iscas.ac.cn
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Xu Wang and committed by
Jonathan Cameron
58a5e29c 07fe995f

+16 -27
+11 -18
drivers/iio/adc/stm32-adc-core.c
··· 535 535 goto err_switches_dis; 536 536 } 537 537 538 - if (priv->bclk) { 539 - ret = clk_prepare_enable(priv->bclk); 540 - if (ret < 0) { 541 - dev_err(dev, "bus clk enable failed\n"); 542 - goto err_regulator_disable; 543 - } 538 + ret = clk_prepare_enable(priv->bclk); 539 + if (ret < 0) { 540 + dev_err(dev, "bus clk enable failed\n"); 541 + goto err_regulator_disable; 544 542 } 545 543 546 - if (priv->aclk) { 547 - ret = clk_prepare_enable(priv->aclk); 548 - if (ret < 0) { 549 - dev_err(dev, "adc clk enable failed\n"); 550 - goto err_bclk_disable; 551 - } 544 + ret = clk_prepare_enable(priv->aclk); 545 + if (ret < 0) { 546 + dev_err(dev, "adc clk enable failed\n"); 547 + goto err_bclk_disable; 552 548 } 553 549 554 550 writel_relaxed(priv->ccr_bak, priv->common.base + priv->cfg->regs->ccr); ··· 552 556 return 0; 553 557 554 558 err_bclk_disable: 555 - if (priv->bclk) 556 - clk_disable_unprepare(priv->bclk); 559 + clk_disable_unprepare(priv->bclk); 557 560 err_regulator_disable: 558 561 regulator_disable(priv->vref); 559 562 err_switches_dis: ··· 570 575 571 576 /* Backup CCR that may be lost (depends on power state to achieve) */ 572 577 priv->ccr_bak = readl_relaxed(priv->common.base + priv->cfg->regs->ccr); 573 - if (priv->aclk) 574 - clk_disable_unprepare(priv->aclk); 575 - if (priv->bclk) 576 - clk_disable_unprepare(priv->bclk); 578 + clk_disable_unprepare(priv->aclk); 579 + clk_disable_unprepare(priv->bclk); 577 580 regulator_disable(priv->vref); 578 581 stm32_adc_core_switches_supply_dis(priv); 579 582 regulator_disable(priv->vdda);
+5 -9
drivers/iio/adc/stm32-adc.c
··· 546 546 if (adc->cfg->unprepare) 547 547 adc->cfg->unprepare(indio_dev); 548 548 549 - if (adc->clk) 550 - clk_disable_unprepare(adc->clk); 549 + clk_disable_unprepare(adc->clk); 551 550 552 551 return 0; 553 552 } ··· 557 558 struct stm32_adc *adc = iio_priv(indio_dev); 558 559 int ret; 559 560 560 - if (adc->clk) { 561 - ret = clk_prepare_enable(adc->clk); 562 - if (ret) 563 - return ret; 564 - } 561 + ret = clk_prepare_enable(adc->clk); 562 + if (ret) 563 + return ret; 565 564 566 565 stm32_adc_set_res(adc); 567 566 ··· 572 575 return 0; 573 576 574 577 err_clk_dis: 575 - if (adc->clk) 576 - clk_disable_unprepare(adc->clk); 578 + clk_disable_unprepare(adc->clk); 577 579 578 580 return ret; 579 581 }