]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
treewide: Remove clk_free
authorSean Anderson <seanga2@gmail.com>
Sat, 16 Dec 2023 19:38:42 +0000 (14:38 -0500)
committerSean Anderson <seanga2@gmail.com>
Tue, 30 Jan 2024 03:35:02 +0000 (22:35 -0500)
This function is a no-op. Remove it.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Link: https://lore.kernel.org/r/20231216193843.2463779-3-seanga2@gmail.com
95 files changed:
arch/arm/mach-rockchip/rk3288/rk3288.c
arch/arm/mach-socfpga/clock_manager_agilex.c
arch/arm/mach-socfpga/clock_manager_arria10.c
arch/arm/mach-socfpga/clock_manager_n5x.c
arch/arm/mach-zynq/clk.c
arch/mips/mach-pic32/cpu.c
board/microchip/pic32mzda/pic32mzda.c
board/sipeed/maix/maix.c
board/synopsys/hsdk/clk-lib.c
drivers/clk/aspeed/clk_ast2600.c
drivers/clk/at91/compat.c
drivers/clk/clk-uclass.c
drivers/clk/clk-xlnx-clock-wizard.c
drivers/clk/clk_versaclock.c
drivers/clk/clk_zynq.c
drivers/clk/clk_zynqmp.c
drivers/clk/imx/clk-imx8.c
drivers/clk/mvebu/armada-37xx-periph.c
drivers/cpu/riscv_cpu.c
drivers/dma/bcm6348-iudma.c
drivers/gpio/at91_gpio.c
drivers/gpio/atmel_pio4.c
drivers/gpio/gpio-rcar.c
drivers/hwspinlock/stm32_hwspinlock.c
drivers/i2c/at91_i2c.c
drivers/i2c/designware_i2c.c
drivers/i2c/i2c-microchip.c
drivers/i2c/npcm_i2c.c
drivers/i2c/ocores_i2c.c
drivers/i2c/stm32f7_i2c.c
drivers/mailbox/stm32-ipcc.c
drivers/misc/ls2_sfp.c
drivers/mmc/arm_pl180_mmci.c
drivers/mmc/aspeed_sdhci.c
drivers/mmc/atmel_sdhci.c
drivers/mmc/gen_atmel_mci.c
drivers/mmc/msm_sdhci.c
drivers/mmc/pic32_sdhci.c
drivers/mmc/renesas-sdhi.c
drivers/mmc/snps_dw_mmc.c
drivers/mmc/socfpga_dw_mmc.c
drivers/mmc/stm32_sdmmc2.c
drivers/mmc/uniphier-sd.c
drivers/mtd/nand/raw/atmel/nand-controller.c
drivers/mtd/renesas_rpc_hf.c
drivers/net/bcm6348-eth.c
drivers/net/bcm6368-eth.c
drivers/net/designware.c
drivers/net/dwc_eth_qos.c
drivers/net/dwc_eth_qos_imx.c
drivers/net/dwc_eth_qos_qcom.c
drivers/net/dwc_eth_qos_rockchip.c
drivers/net/sni_ave.c
drivers/net/ti/am65-cpsw-nuss.c
drivers/phy/bcm6318-usbh-phy.c
drivers/phy/bcm6348-usbh-phy.c
drivers/phy/bcm6368-usbh-phy.c
drivers/phy/meson-axg-mipi-dphy.c
drivers/phy/meson-g12a-usb3-pcie.c
drivers/phy/meson-gxl-usb2.c
drivers/phy/phy-rcar-gen2.c
drivers/phy/phy-rcar-gen3.c
drivers/pinctrl/pinctrl-k210.c
drivers/power/domain/imx8mp-hsiomix.c
drivers/rtc/stm32_rtc.c
drivers/serial/atmel_usart.c
drivers/serial/serial_bcm6345.c
drivers/serial/serial_msm.c
drivers/serial/serial_pic32.c
drivers/spi/atcspi200_spi.c
drivers/spi/atmel-quadspi.c
drivers/spi/atmel_spi.c
drivers/spi/bcm63xx_hsspi.c
drivers/spi/bcm63xx_spi.c
drivers/spi/bcmbca_hsspi.c
drivers/spi/cadence_qspi.c
drivers/spi/designware_spi.c
drivers/spi/meson_spifc_a1.c
drivers/spi/mvebu_a3700_spi.c
drivers/spi/spi-aspeed-smc.c
drivers/spi/stm32_spi.c
drivers/timer/dw-apb-timer.c
drivers/timer/ostm_timer.c
drivers/usb/dwc3/dwc3-meson-g12a.c
drivers/usb/dwc3/dwc3-meson-gxl.c
drivers/usb/host/ehci-atmel.c
drivers/usb/host/ohci-da8xx.c
drivers/usb/host/xhci-rcar.c
drivers/video/atmel_hlcdfb.c
drivers/video/mali_dp.c
drivers/video/rockchip/rk3288_hdmi.c
drivers/video/rockchip/rk_edp.c
drivers/watchdog/designware_wdt.c
drivers/watchdog/meson_gxbb_wdt.c
include/clk.h

index 26c7e41cd89e6b9b4da8706d3d43b48deae8fa98..d9f782e342ba95a670ee1ba356fca9109a450289 100644 (file)
@@ -184,8 +184,6 @@ static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
 
                rate = clk_get_rate(&clk);
                printf("%s: %lu\n", clks[i].name, rate);
-
-               clk_free(&clk);
        }
 
        return 0;
index e035c09aaefe92a9396790c39432104d79747c38..28f593b60e63575d138b9490e482c6494c504776 100644 (file)
@@ -37,8 +37,6 @@ static ulong cm_get_rate_dm(u32 id)
 
        rate = clk_get_rate(&clk);
 
-       clk_free(&clk);
-
        if ((rate == (unsigned long)-ENOSYS) ||
            (rate == (unsigned long)-ENXIO) ||
            (rate == (unsigned long)-EIO)) {
index b48a2b47bcdc0b30c30dbbaadb271322677ff47f..8ab18f6b725296eeff1dcac3adec5eee97f1d8e9 100644 (file)
@@ -962,7 +962,6 @@ static u32 cm_get_rate_dm(char *name)
        struct uclass *uc;
        struct udevice *dev = NULL;
        struct clk clk = { 0 };
-       ulong rate;
        int ret;
 
        /* Device addresses start at 1 */
@@ -982,11 +981,7 @@ static u32 cm_get_rate_dm(char *name)
        if (ret)
                return 0;
 
-       rate = clk_get_rate(&clk);
-
-       clk_free(&clk);
-
-       return rate;
+       return clk_get_rate(&clk);
 }
 
 static u32 cm_get_rate_dm_khz(char *name)
index 4f098533e7cc32ebcfb0c1bf20a531691f4261fa..0ed480de670d36a4b89715c3719d1ee48b9f8452 100644 (file)
@@ -36,8 +36,6 @@ static ulong cm_get_rate_dm(u32 id)
 
        rate = clk_get_rate(&clk);
 
-       clk_free(&clk);
-
        if ((rate == (unsigned long)-ENXIO) ||
            (rate == (unsigned long)-EIO)) {
                debug("%s id %u: clk_get_rate err: %ld\n",
index e6a67326dd4a51cc3f48a7ddd700fe2f51198997..5e1ba8d43ed1920bd2740fb080e0cd803edc9b69 100644 (file)
@@ -44,8 +44,6 @@ int set_cpu_clk_info(void)
                        gd->bd->bi_arm_freq = rate;
                        gd->cpu_clk = clk_get_rate(&clk);
                }
-
-               clk_free(&clk);
        }
        gd->bd->bi_dsp_freq = 0;
 
index 3181a946a27ef4cd42b8b4ae003cfb44e3338a89..668adbbda6200a297f00c0f8e551f97a5e8d3853 100644 (file)
@@ -30,7 +30,6 @@ static ulong rate(int id)
        int ret;
        struct udevice *dev;
        struct clk clk;
-       ulong rate;
 
        ret = uclass_get_device(UCLASS_CLK, 0, &dev);
        if (ret) {
@@ -43,11 +42,7 @@ static ulong rate(int id)
        if (ret < 0)
                return ret;
 
-       rate = clk_get_rate(&clk);
-
-       clk_free(&clk);
-
-       return rate;
+       return clk_get_rate(&clk);
 }
 
 static ulong clk_get_cpu_rate(void)
index e7337deea7fa886571a94fd547cce06f42db789d..3c2203d22025216efa369f967f28e26273bcedf0 100644 (file)
@@ -36,8 +36,6 @@ int checkboard(void)
        rate = clk_get_rate(&clk);
        printf("CPU Speed: %lu MHz\n", rate / 1000000);
 
-       clk_free(&clk);
-
        return 0;
 }
 #endif
index 79e492f0a8ec4f5dc7e4ca76607516b5d0f952d1..06653b5a8765922d4efde12cd40d7e52868526f7 100644 (file)
@@ -32,7 +32,6 @@ static int sram_init(void)
                        continue;
 
                ret = clk_enable(&clk);
-               clk_free(&clk);
                if (ret)
                        return ret;
        }
index be76d6c8f471bbe388f8e485cbb455d5abe1f960..a9614e90800be03eb3605ebddcb061e2f1998fb5 100644 (file)
@@ -56,8 +56,6 @@ int soc_clk_ctl(const char *name, ulong *rate, enum clk_ctl_ops ctl)
 
        priv_rate = clk_get_rate(&clk);
 
-       clk_free(&clk);
-
        mhz_rate = ceil(priv_rate, HZ_IN_MHZ);
 
        if (ctl & CLK_MHZ)
index eecfacd7fc0b7cd7ff34bf729e06c658c2d2594e..a15909329bbdbb96b87b1389cd342fcdf04dd65a 100644 (file)
@@ -1143,8 +1143,6 @@ static void ast2600_clk_dump(struct udevice *dev)
                ret = clk_get_rate(&clk);
                rate = ret;
 
-               clk_free(&clk);
-
                if (ret == -EINVAL) {
                        printf("clk ID %lu not supported yet\n",
                               aspeed_clk_names[i].id);
index 2fdc2fbd5547c9350b96ebf0075a7370e8c6c48d..ee67093c60737bb88cf1046b65513f954acf0ca8 100644 (file)
@@ -516,7 +516,6 @@ static ulong periph_get_rate(struct clk *clk)
 {
        struct udevice *dev;
        struct clk clk_dev;
-       ulong clk_rate;
        int ret;
 
        dev = dev_get_parent(clk->dev);
@@ -525,11 +524,7 @@ static ulong periph_get_rate(struct clk *clk)
        if (ret)
                return ret;
 
-       clk_rate = clk_get_rate(&clk_dev);
-
-       clk_free(&clk_dev);
-
-       return clk_rate;
+       return clk_get_rate(&clk_dev);
 }
 
 static struct clk_ops periph_clk_ops = {
@@ -762,7 +757,6 @@ static ulong generic_clk_get_rate(struct clk *clk)
        struct pmc_plat *plat = dev_get_plat(clk->dev);
        struct at91_pmc *pmc = plat->reg_base;
        struct clk parent;
-       ulong clk_rate;
        u32 tmp, gckdiv;
        u8 clock_source, parent_index;
        int ret;
@@ -778,11 +772,7 @@ static ulong generic_clk_get_rate(struct clk *clk)
        if (ret)
                return 0;
 
-       clk_rate = clk_get_rate(&parent) / (gckdiv + 1);
-
-       clk_free(&parent);
-
-       return clk_rate;
+       return clk_get_rate(&parent) / (gckdiv + 1);
 }
 
 static ulong generic_clk_set_rate(struct clk *clk, ulong rate)
index 4bd2d8c26282002dc7e4ba4e900e649cf52c0f46..ed6e60bc4841892c8b42f81edf3cda4994a903ac 100644 (file)
@@ -437,8 +437,6 @@ int clk_release_all(struct clk *clk, unsigned int count)
                ret = clk_disable(&clk[i]);
                if (ret && ret != -ENOSYS)
                        return ret;
-
-               clk_free(&clk[i]);
        }
 
        return 0;
@@ -772,22 +770,12 @@ bool clk_is_match(const struct clk *p, const struct clk *q)
        return false;
 }
 
-static void devm_clk_release(struct udevice *dev, void *res)
-{
-       clk_free(res);
-}
-
-static int devm_clk_match(struct udevice *dev, void *res, void *data)
-{
-       return res == data;
-}
-
 struct clk *devm_clk_get(struct udevice *dev, const char *id)
 {
        int rc;
        struct clk *clk;
 
-       clk = devres_alloc(devm_clk_release, sizeof(struct clk), __GFP_ZERO);
+       clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL);
        if (unlikely(!clk))
                return ERR_PTR(-ENOMEM);
 
@@ -795,21 +783,9 @@ struct clk *devm_clk_get(struct udevice *dev, const char *id)
        if (rc)
                return ERR_PTR(rc);
 
-       devres_add(dev, clk);
        return clk;
 }
 
-void devm_clk_put(struct udevice *dev, struct clk *clk)
-{
-       int rc;
-
-       if (!clk)
-               return;
-
-       rc = devres_release(dev, devm_clk_release, devm_clk_match, clk);
-       WARN_ON(rc);
-}
-
 int clk_uclass_post_probe(struct udevice *dev)
 {
        /*
index 70ee3af1074917366a05e7af01ad1a8cf73128d8..a10a843f11f9bb169109295af30fd878ee32f50e 100644 (file)
@@ -137,7 +137,6 @@ static int clk_wzrd_probe(struct udevice *dev)
        ret = clk_enable(&clk_in1);
        if (ret) {
                dev_err(dev, "failed to enable clock\n");
-               clk_free(&clk_in1);
                return ret;
        }
 
index 699df3cf3ee3a20cd200c48fda3813ea77d4037a..bbe722560329c05950dbd15287075d40e8ff6879 100644 (file)
@@ -1000,26 +1000,18 @@ int versaclock_probe(struct udevice *dev)
        return 0;
 
 free_out:
-       for (n = 1; n < vc5->chip_info->clk_out_cnt; n++) {
-               clk_free(&vc5->clk_out[n].hw);
+       for (n = 1; n < vc5->chip_info->clk_out_cnt; n++)
                free(out_name[n]);
-       }
 free_selb:
-       clk_free(&vc5->clk_out[0].hw);
        free(outsel_name);
 free_fod:
-       for (n = 0; n < vc5->chip_info->clk_fod_cnt; n++) {
-               clk_free(&vc5->clk_fod[n].hw);
+       for (n = 0; n < vc5->chip_info->clk_fod_cnt; n++)
                free(fod_name[n]);
-       }
 free_pll:
-       clk_free(&vc5->clk_pll.hw);
        free(pll_name);
 free_pfd:
-       clk_free(&vc5->clk_pfd);
        free(pfd_name);
 free_mux:
-       clk_free(&vc5->clk_mux);
        free(mux_name);
 
        return ret;
index 34f964d72af8bc2352d7dc407cd29a4235c67861..e3cefe2e0c72f48b0bc991e9d4c91ab490ae8fed 100644 (file)
@@ -491,8 +491,6 @@ static void zynq_clk_dump(struct udevice *dev)
 
                        rate = clk_get_rate(&clk);
 
-                       clk_free(&clk);
-
                        if ((rate == (unsigned long)-ENOSYS) ||
                            (rate == (unsigned long)-ENXIO))
                                printf("%10s%20s\n", name, "unknown");
index 0ffac194a19226611ec2f39d8cd2703f23692f45..e23f7da3f9299910ab1a930db6a43963ad842efd 100644 (file)
@@ -757,8 +757,6 @@ static void zynqmp_clk_dump(struct udevice *dev)
 
                        rate = clk_get_rate(&clk);
 
-                       clk_free(&clk);
-
                        if ((rate == (unsigned long)-ENOSYS) ||
                            (rate == (unsigned long)-ENXIO) ||
                            (rate == (unsigned long)-EIO))
index 9600672e071320c83880d9071afb620823c880c0..d39b87b2e245fce46ac417f800f0f730878dd0bb 100644 (file)
@@ -62,8 +62,6 @@ static void imx8_clk_dump(struct udevice *dev)
                ret = clk_get_rate(&clk);
                rate = ret;
 
-               clk_free(&clk);
-
                if (ret == -EINVAL) {
                        printf("clk ID %lu not supported yet\n",
                               imx8_clk_names[i].id);
index 1a7097029ae706d4c9b8f049d3309da0315afe06..f5c9bd735c1381c3855b3abc77834e0cb9c4f4f8 100644 (file)
@@ -454,7 +454,6 @@ static int armada_37xx_periph_clk_set_parent(struct clk *clk,
        if (parent->dev != check_parent.dev)
                ret = -EINVAL;
 
-       clk_free(&check_parent);
        if (ret < 0)
                return ret;
 
@@ -596,7 +595,6 @@ static int armada_37xx_periph_clk_probe(struct udevice *dev)
                }
 
                priv->parents[i] = clk_get_rate(&clk);
-               clk_free(&clk);
        }
 
        return 0;
index 034b9b49c05c50afad77e45409e2a49f4fea9543..a9b253719f7f45925dc0e4af82e6c798ca5e04bf 100644 (file)
@@ -45,7 +45,6 @@ static int riscv_cpu_get_info(const struct udevice *dev, struct cpu_info *info)
                ret = clk_get_rate(&clk);
                if (!IS_ERR_VALUE(ret))
                        info->cpu_freq = ret;
-               clk_free(&clk);
        }
 
        if (!info->cpu_freq)
@@ -145,7 +144,6 @@ static int riscv_cpu_probe(struct udevice *dev)
                return 0;
 
        ret = clk_enable(&clk);
-       clk_free(&clk);
        if (ret == -ENOSYS || ret == -ENOTSUPP)
                return 0;
        else
index d4cfe0c186811da0ede149329327ecb5c6f9c872..33c7b9814156aed3da4fcbd9627b44d65861d8d6 100644 (file)
@@ -596,8 +596,6 @@ static int bcm6348_iudma_probe(struct udevice *dev)
                        pr_err("error enabling clock %d\n", i);
                        return ret;
                }
-
-               clk_free(&clk);
        }
 
        /* try to perform resets */
index 1409db5dc115fdb8dc2c1d674075d27a6552a994..f80f4afd24ff420def5fa528e94c5faa4612f441 100644 (file)
@@ -603,8 +603,6 @@ static int at91_gpio_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       clk_free(&clk);
-
 #if CONFIG_IS_ENABLED(OF_CONTROL)
        plat->base_addr = dev_read_addr(dev);
 #endif
index 47ed297981451d9e4667b86d78bb8132065cf8ae..be1dd752bf769b06d6c688fc7d236b2ed9e01cdd 100644 (file)
@@ -310,8 +310,6 @@ static int atmel_pio4_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       clk_free(&clk);
-
        addr_base = dev_read_addr(dev);
        if (addr_base == FDT_ADDR_T_NONE)
                return -EINVAL;
index d6cfbd231a8796fe5c632c3d70a784a4bc1ad747..707785012322eb8b3aa21fe7bc2a6b59a6bd8e6a 100644 (file)
@@ -165,7 +165,6 @@ static int rcar_gpio_probe(struct udevice *dev)
        }
 
        ret = clk_enable(&clk);
-       clk_free(&clk);
        if (ret) {
                dev_err(dev, "Failed to enable GPIO bank clock\n");
                return ret;
index 46ed64655a8778a0b78042181ee1a50a34921963..346b138e98f002629c702e1a001dc29b59c1be71 100644 (file)
@@ -69,11 +69,7 @@ static int stm32mp1_hwspinlock_probe(struct udevice *dev)
        if (ret)
                return ret;
 
-       ret = clk_enable(&clk);
-       if (ret)
-               clk_free(&clk);
-
-       return ret;
+       return clk_enable(&clk);
 }
 
 static const struct hwspinlock_ops stm32mp1_hwspinlock_ops = {
index e743d2a849a3b042625285974fbf512e4aa5566d..b7a25885e66634cc7a8a062e5cbe761dc058fdda 100644 (file)
@@ -201,8 +201,6 @@ static int at91_i2c_enable_clk(struct udevice *dev)
 
        bus->bus_clk_rate = clk_rate;
 
-       clk_free(&clk);
-
        return 0;
 }
 
index 215ce010cb7d19579286ade8885323604bb35374..29cf63375c7f173e71c8265f69ddd041c8fbc4f2 100644 (file)
@@ -770,7 +770,6 @@ int designware_i2c_of_to_plat(struct udevice *bus)
 
        ret = clk_enable(&priv->clk);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
-               clk_free(&priv->clk);
                dev_err(bus, "failed to enable clock\n");
                return ret;
        }
@@ -803,7 +802,6 @@ int designware_i2c_remove(struct udevice *dev)
 
 #if CONFIG_IS_ENABLED(CLK)
        clk_disable(&priv->clk);
-       clk_free(&priv->clk);
 #endif
 
        return reset_release_bulk(&priv->resets);
index d82b80f53556afef0967b0027a399381f7c3b360..d453e243d6f2b24e94433c304ff6c7a684a1dde3 100644 (file)
@@ -183,8 +183,6 @@ static int mpfs_i2c_init(struct mpfs_i2c_bus *bus, struct udevice *dev)
        if (!clk_rate)
                return -EINVAL;
 
-       clk_free(&bus->i2c_clk);
-
        divisor = clk_rate / bus->clk_rate;
 
        ctrl = readl(bus->base + MPFS_I2C_CTRL);
index b867b6c8e91b0c7b87ab0b6834b3eef272f5d3ba..c64752e1467e9e80c93a074b2319bf2e76bfe025 100644 (file)
@@ -570,7 +570,6 @@ static int npcm_i2c_probe(struct udevice *dev)
                printf("%s: fail to get rate\n", __func__);
                return -EINVAL;
        }
-       clk_free(&clk);
 
        bus->num = dev->seq_;
        bus->reg = dev_read_addr_ptr(dev);
index 3b19ba78fa32454f1685ec3fc8f5197726625db1..fff85118d0de1f68cd025217fee44c3190d3b649 100644 (file)
@@ -396,8 +396,6 @@ static int ocores_i2c_enable_clk(struct udevice *dev)
 
        bus->ip_clk_khz = clk_rate / 1000;
 
-       clk_free(&bus->clk);
-
        return 0;
 }
 
index eaa1d692898bc7179712692b934b99a52460c324..f42e08a6418038dec61b9591032a231709eb1399 100644 (file)
@@ -890,7 +890,7 @@ static int stm32_i2c_probe(struct udevice *dev)
 
        ret = clk_enable(&i2c_priv->clk);
        if (ret)
-               goto clk_free;
+               return ret;
 
        ret = reset_get_by_index(dev, 0, &reset_ctl);
        if (ret)
@@ -904,8 +904,6 @@ static int stm32_i2c_probe(struct udevice *dev)
 
 clk_disable:
        clk_disable(&i2c_priv->clk);
-clk_free:
-       clk_free(&i2c_priv->clk);
 
        return ret;
 }
index 69c86e059f5a5f68d42bccebbcf43317b4551420..046e1a8aca6e6af41ac4d78fb5f30451b2139ad3 100644 (file)
@@ -134,18 +134,13 @@ static int stm32_ipcc_probe(struct udevice *dev)
 
        ret = clk_enable(&clk);
        if (ret)
-               goto clk_free;
+               return ret;
 
        /* get channel number */
        ipcc->n_chans = readl(ipcc->reg_base + IPCC_HWCFGR);
        ipcc->n_chans &= IPCFGR_CHAN_MASK;
 
        return 0;
-
-clk_free:
-       clk_free(&clk);
-
-       return ret;
 }
 
 static const struct udevice_id stm32_ipcc_ids[] = {
index 2a81bc7de5f43d552941e43e3b066213a75e2bbc..5351c7ed34fd0ac8686d36ad36460bb56848b168 100644 (file)
@@ -249,7 +249,6 @@ static int ls2_sfp_probe(struct udevice *dev)
                }
 
                rate = clk_get_rate(&clk);
-               clk_free(&clk);
                if (!rate || IS_ERR_VALUE(rate)) {
                        ret = rate ? rate : -ENOENT;
                        dev_dbg(dev, "could not get clock rate (err %d)\n",
index 9c5d48e90cd8a5c8855b034f61094153a6019aae..5cf5502ed545c653713f7d646db4c314da768132 100644 (file)
@@ -447,7 +447,6 @@ static int arm_pl180_mmc_probe(struct udevice *dev)
 
        ret = clk_enable(&clk);
        if (ret) {
-               clk_free(&clk);
                dev_err(dev, "failed to enable clock\n");
                return ret;
        }
index 9d79bf58cc70ba474a3f873c8efb38713443711f..c9626c6beb8f697180cd4758aa33a2afd6141954 100644 (file)
@@ -35,7 +35,7 @@ static int aspeed_sdhci_probe(struct udevice *dev)
        ret = clk_enable(&clk);
        if (ret) {
                debug("%s: clock enable failed %d\n", __func__, ret);
-               goto free;
+               return ret;
        }
 
        host->name = dev->name;
@@ -66,8 +66,6 @@ static int aspeed_sdhci_probe(struct udevice *dev)
 
 err:
        clk_disable(&clk);
-free:
-       clk_free(&clk);
        return ret;
 }
 
index 5347ba90431f817fbc110a2c9e7d1cdccb772f58..d92bad97b71e9c2964ca969a1b54704e3c8bfca4 100644 (file)
@@ -147,8 +147,6 @@ static int atmel_sdhci_probe(struct udevice *dev)
        host->ops = &atmel_sdhci_ops;
        upriv->mmc = host->mmc;
 
-       clk_free(&clk);
-
        ret = sdhci_probe(dev);
        if (ret)
                return ret;
index d91819acfd7fba8126b89910fae11899d948ee03..3ee99558f6f9f50c56162c8e28084fb85ded1736 100644 (file)
@@ -559,27 +559,20 @@ static int atmel_mci_enable_clk(struct udevice *dev)
        int ret = 0;
 
        ret = clk_get_by_index(dev, 0, &clk);
-       if (ret) {
-               ret = -EINVAL;
-               goto failed;
-       }
+       if (ret)
+               return -EINVAL;
 
        ret = clk_enable(&clk);
        if (ret)
-               goto failed;
+               return ret;
 
        clk_rate = clk_get_rate(&clk);
-       if (!clk_rate) {
-               ret = -EINVAL;
-               goto failed;
-       }
+       if (!clk_rate)
+               return -EINVAL;
 
        priv->bus_clk_rate = clk_rate;
 
-failed:
-       clk_free(&clk);
-
-       return ret;
+       return 0;
 }
 
 static int atmel_mci_probe(struct udevice *dev)
index 604f9c3ff99cc91c6e71d9209d05266f6599182c..fe1e754bfde0e47f641a78ba9d3860c0a02c6f24 100644 (file)
@@ -81,7 +81,6 @@ static int msm_sdc_clk_init(struct udevice *dev)
                return ret;
 
        ret = clk_set_rate(&clk, clk_rate);
-       clk_free(&clk);
        if (ret < 0)
                return ret;
 
index fe555106a1d36722a6968cb2bf121d86ea74ab28..7a8e33dbc7a7669416e6356578bc5c81b4d42de2 100644 (file)
@@ -32,7 +32,6 @@ static int pic32_sdhci_probe(struct udevice *dev)
                return ret;
 
        clk_rate = clk_get_rate(&clk);
-       clk_free(&clk);
 
        if (IS_ERR_VALUE(clk_rate))
                return clk_rate;
index 97aaf1e4ec3887d4eb91325b1363dcf3cb282716..a74559ca686dfe3d6bac6838a1164aee150f6165 100644 (file)
@@ -979,19 +979,19 @@ static int rzg2l_sdhi_setup(struct udevice *dev)
        ret = clk_get_by_name(dev, "cd", &imclk2);
        if (ret < 0) {
                dev_err(dev, "failed to get imclk2 (chip detect clk)\n");
-               goto err_get_imclk2;
+               return ret;
        }
 
        ret = clk_get_by_name(dev, "aclk", &aclk);
        if (ret < 0) {
                dev_err(dev, "failed to get aclk\n");
-               goto err_get_aclk;
+               return ret;
        }
 
        ret = clk_enable(&imclk2);
        if (ret < 0) {
                dev_err(dev, "failed to enable imclk2 (chip detect clk)\n");
-               goto err_imclk2;
+               return ret;
        }
 
        ret = clk_enable(&aclk);
@@ -1026,11 +1026,6 @@ err_get_reset:
        clk_disable(&aclk);
 err_aclk:
        clk_disable(&imclk2);
-err_imclk2:
-       clk_free(&aclk);
-err_get_aclk:
-       clk_free(&imclk2);
-err_get_imclk2:
        return ret;
 }
 
@@ -1071,7 +1066,7 @@ static int renesas_sdhi_probe(struct udevice *dev)
                ret = clk_set_rate(&priv->clkh, 800000000);
                if (ret < 0) {
                        dev_err(dev, "failed to set rate for SDnH clock (%d)\n", ret);
-                       goto err_clk;
+                       return ret;
                }
        }
 
@@ -1079,13 +1074,13 @@ static int renesas_sdhi_probe(struct udevice *dev)
        ret = clk_set_rate(&priv->clk, 200000000);
        if (ret < 0) {
                dev_err(dev, "failed to set rate for SDn clock (%d)\n", ret);
-               goto err_clkh;
+               return ret;
        }
 
        ret = clk_enable(&priv->clk);
        if (ret) {
                dev_err(dev, "failed to enable SDn clock (%d)\n", ret);
-               goto err_clkh;
+               return ret;
        }
 
        if (device_is_compatible(dev, "renesas,sdhi-r9a07g044"))
@@ -1107,10 +1102,6 @@ static int renesas_sdhi_probe(struct udevice *dev)
 
 err_tmio_probe:
        clk_disable(&priv->clk);
-err_clkh:
-       clk_free(&priv->clkh);
-err_clk:
-       clk_free(&priv->clk);
        return ret;
 }
 
index 50a8805e736bef783830b585fb2ab2b68d45f71f..0134399e3934c5865b4473d038363f45d4ba4b18 100644 (file)
@@ -46,7 +46,7 @@ static int snps_dwmmc_clk_setup(struct udevice *dev)
 
        ret = clk_enable(&clk_ciu);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP)
-               goto clk_err_ciu;
+               goto clk_err;
 
        host->bus_hz = clk_get_rate(&clk_ciu);
        if (host->bus_hz < CLOCK_MIN) {
@@ -60,16 +60,12 @@ static int snps_dwmmc_clk_setup(struct udevice *dev)
 
        ret = clk_enable(&clk_biu);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP)
-               goto clk_err_biu;
+               goto clk_err_ciu_dis;
 
        return 0;
 
-clk_err_biu:
-       clk_free(&clk_biu);
 clk_err_ciu_dis:
        clk_disable(&clk_ciu);
-clk_err_ciu:
-       clk_free(&clk_ciu);
 clk_err:
        dev_err(dev, "failed to setup clocks, ret %d\n", ret);
 
index be3d8bfb3d71288ed65ee7b1bad445bd98ccd63c..387cb8b6b50a1cbac0b0bfe29d8c601a75af032c 100644 (file)
@@ -99,7 +99,6 @@ static int socfpga_dwmmc_get_clk_rate(struct udevice *dev)
 
        host->bus_hz = clk_get_rate(&clk);
 
-       clk_free(&clk);
 #else
        /* Fixed clock divide by 4 which due to the SDMMC wrapper */
        host->bus_hz = cm_get_mmc_controller_clk_hz();
index 5ff5e1a4d8b58ec7812e6f9676a750c2350f1c29..a2b111a84355dbd1b5e017025b4b8c47f215a5bb 100644 (file)
@@ -766,10 +766,8 @@ static int stm32_sdmmc2_probe(struct udevice *dev)
        int ret;
 
        ret = clk_enable(&plat->clk);
-       if (ret) {
-               clk_free(&plat->clk);
+       if (ret)
                return ret;
-       }
 
        upriv->mmc = &plat->mmc;
 
index 75003a0113e259b36e8855e6bf7a5ff9c052cc7b..8cde4308aaede48ce195faaaf5c2914702e76831 100644 (file)
@@ -64,7 +64,6 @@ static int uniphier_sd_probe(struct udevice *dev)
        ret = clk_set_rate(&priv->clk, ULONG_MAX);
        if (ret < 0) {
                dev_err(dev, "failed to set rate for host clock\n");
-               clk_free(&priv->clk);
                return ret;
        }
 
index a2151f98491f311f513ae29551e327d7404690d2..0e0441472b80a6363d84071ed4cc0f7759e14a1f 100644 (file)
@@ -1999,10 +1999,8 @@ atmel_hsmc_nand_controller_remove(struct atmel_nand_controller *nc)
 
        hsmc_nc = container_of(nc, struct atmel_hsmc_nand_controller, base);
 
-       if (hsmc_nc->clk) {
+       if (hsmc_nc->clk)
                clk_disable_unprepare(hsmc_nc->clk);
-               devm_clk_put(nc->dev, hsmc_nc->clk);
-       }
 
        return 0;
 }
index aca7a6cdd25b54ebe3a7476e663486c2a2766176..979b64d4a2f69de81592aba28a8f33993fbeacba 100644 (file)
@@ -370,7 +370,6 @@ static int rpc_hf_probe(struct udevice *dev)
        }
 
        ret = clk_enable(&clk);
-       clk_free(&clk);
        if (ret) {
                dev_err(dev, "Failed to enable RPC clock\n");
                return ret;
index 72dcd07d30dd1a071266e81bbf7ae654e63053de..15a94f6ce9a105064761c08c77b7f3ae264d38d3 100644 (file)
@@ -457,8 +457,6 @@ static int bcm6348_eth_probe(struct udevice *dev)
                        pr_err("%s: error enabling clock %d\n", __func__, i);
                        return ret;
                }
-
-               clk_free(&clk);
        }
 
        /* try to perform resets */
index fdd938ce0dd82d75328fa71f200ee0573552f80e..9679a45b0758fae6f4398033bb1dfe7b83d4c17e 100644 (file)
@@ -546,8 +546,6 @@ static int bcm6368_eth_probe(struct udevice *dev)
                        pr_err("%s: error enabling clock %d\n", __func__, i);
                        return ret;
                }
-
-               clk_free(&clk);
        }
 
        /* try to perform resets */
index a174344b3ef512414b7639c13f7fb99f20253bbf..c8696358d6f7b36b683c53ef9696e799d46818dd 100644 (file)
@@ -702,7 +702,6 @@ int designware_eth_probe(struct udevice *dev)
                        err = clk_enable(&priv->clocks[i]);
                        if (err && err != -ENOSYS && err != -ENOTSUPP) {
                                pr_err("failed to enable clock %d\n", i);
-                               clk_free(&priv->clocks[i]);
                                goto clk_err;
                        }
                        priv->clock_count++;
index e40e399c802dce26d0444d600383aed0ed874d4d..9b3bce1dc87979eef8fb4b9f23dc8672671fb28d 100644 (file)
@@ -1382,38 +1382,30 @@ static int eqos_probe_resources_tegra186(struct udevice *dev)
        ret = clk_get_by_name(dev, "master_bus", &eqos->clk_master_bus);
        if (ret) {
                pr_err("clk_get_by_name(master_bus) failed: %d", ret);
-               goto err_free_clk_slave_bus;
+               goto err_free_gpio_phy_reset;
        }
 
        ret = clk_get_by_name(dev, "rx", &eqos->clk_rx);
        if (ret) {
                pr_err("clk_get_by_name(rx) failed: %d", ret);
-               goto err_free_clk_master_bus;
+               goto err_free_gpio_phy_reset;
        }
 
        ret = clk_get_by_name(dev, "ptp_ref", &eqos->clk_ptp_ref);
        if (ret) {
                pr_err("clk_get_by_name(ptp_ref) failed: %d", ret);
-               goto err_free_clk_rx;
+               goto err_free_gpio_phy_reset;
        }
 
        ret = clk_get_by_name(dev, "tx", &eqos->clk_tx);
        if (ret) {
                pr_err("clk_get_by_name(tx) failed: %d", ret);
-               goto err_free_clk_ptp_ref;
+               goto err_free_gpio_phy_reset;
        }
 
        debug("%s: OK\n", __func__);
        return 0;
 
-err_free_clk_ptp_ref:
-       clk_free(&eqos->clk_ptp_ref);
-err_free_clk_rx:
-       clk_free(&eqos->clk_rx);
-err_free_clk_master_bus:
-       clk_free(&eqos->clk_master_bus);
-err_free_clk_slave_bus:
-       clk_free(&eqos->clk_slave_bus);
 err_free_gpio_phy_reset:
        dm_gpio_free(dev, &eqos->phy_reset_gpio);
 err_free_reset_eqos:
@@ -1451,13 +1443,13 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
        ret = clk_get_by_name(dev, "mac-clk-rx", &eqos->clk_rx);
        if (ret) {
                pr_err("clk_get_by_name(rx) failed: %d", ret);
-               goto err_free_clk_master_bus;
+               goto err_probe;
        }
 
        ret = clk_get_by_name(dev, "mac-clk-tx", &eqos->clk_tx);
        if (ret) {
                pr_err("clk_get_by_name(tx) failed: %d", ret);
-               goto err_free_clk_rx;
+               goto err_probe;
        }
 
        /*  Get ETH_CLK clocks (optional) */
@@ -1468,10 +1460,6 @@ static int eqos_probe_resources_stm32(struct udevice *dev)
        debug("%s: OK\n", __func__);
        return 0;
 
-err_free_clk_rx:
-       clk_free(&eqos->clk_rx);
-err_free_clk_master_bus:
-       clk_free(&eqos->clk_master_bus);
 err_probe:
 
        debug("%s: returns %d\n", __func__, ret);
@@ -1489,13 +1477,6 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)
 
        debug("%s(dev=%p):\n", __func__, dev);
 
-#ifdef CONFIG_CLK
-       clk_free(&eqos->clk_tx);
-       clk_free(&eqos->clk_ptp_ref);
-       clk_free(&eqos->clk_rx);
-       clk_free(&eqos->clk_slave_bus);
-       clk_free(&eqos->clk_master_bus);
-#endif
        dm_gpio_free(dev, &eqos->phy_reset_gpio);
        reset_free(&eqos->reset_ctl);
 
@@ -1505,19 +1486,7 @@ static int eqos_remove_resources_tegra186(struct udevice *dev)
 
 static int eqos_remove_resources_stm32(struct udevice *dev)
 {
-       struct eqos_priv * __maybe_unused eqos = dev_get_priv(dev);
-
        debug("%s(dev=%p):\n", __func__, dev);
-
-#ifdef CONFIG_CLK
-       clk_free(&eqos->clk_tx);
-       clk_free(&eqos->clk_rx);
-       clk_free(&eqos->clk_master_bus);
-       if (clk_valid(&eqos->clk_ck))
-               clk_free(&eqos->clk_ck);
-#endif
-
-       debug("%s: OK\n", __func__);
        return 0;
 }
 
index e3f55dd981738244cef7ed01ec72cbfef899e0e2..9c4e390441333fe3c8b50f541b402dc776d6df49 100644 (file)
@@ -70,30 +70,24 @@ static int eqos_probe_resources_imx(struct udevice *dev)
        ret = clk_get_by_name(dev, "ptp_ref", &eqos->clk_ptp_ref);
        if (ret) {
                dev_dbg(dev, "clk_get_by_name(ptp_ref) failed: %d", ret);
-               goto err_free_clk_master_bus;
+               goto err_probe;
        }
 
        ret = clk_get_by_name(dev, "tx", &eqos->clk_tx);
        if (ret) {
                dev_dbg(dev, "clk_get_by_name(tx) failed: %d", ret);
-               goto err_free_clk_ptp_ref;
+               goto err_probe;
        }
 
        ret = clk_get_by_name(dev, "pclk", &eqos->clk_ck);
        if (ret) {
                dev_dbg(dev, "clk_get_by_name(pclk) failed: %d", ret);
-               goto err_free_clk_tx;
+               goto err_probe;
        }
 
        debug("%s: OK\n", __func__);
        return 0;
 
-err_free_clk_tx:
-       clk_free(&eqos->clk_tx);
-err_free_clk_ptp_ref:
-       clk_free(&eqos->clk_ptp_ref);
-err_free_clk_master_bus:
-       clk_free(&eqos->clk_master_bus);
 err_probe:
 
        debug("%s: returns %d\n", __func__, ret);
@@ -102,16 +96,7 @@ err_probe:
 
 static int eqos_remove_resources_imx(struct udevice *dev)
 {
-       struct eqos_priv *eqos = dev_get_priv(dev);
-
        debug("%s(dev=%p):\n", __func__, dev);
-
-       clk_free(&eqos->clk_ck);
-       clk_free(&eqos->clk_tx);
-       clk_free(&eqos->clk_ptp_ref);
-       clk_free(&eqos->clk_master_bus);
-
-       debug("%s: OK\n", __func__);
        return 0;
 }
 
index df83f1c5f9e111b4bf303d77ed5703e9861020a4..8178138fc659111d58aaca7b3dcddf475245961d 100644 (file)
@@ -575,7 +575,6 @@ static int eqos_remove_resources_qcom(struct udevice *dev)
 
        debug("%s(dev=%p):\n", __func__, dev);
 
-       clk_free(&eqos->clk_tx);
        dm_gpio_free(dev, &eqos->phy_reset_gpio);
        reset_free(&eqos->reset_ctl);
 
index 834307a4477d6c059293d71510d1734f40223237..fa9e513faea3011741926509af2160015181a746 100644 (file)
@@ -372,7 +372,7 @@ static int eqos_probe_resources_rk(struct udevice *dev)
                ret = clk_get_by_name(dev, "clk_mac_speed", &eqos->clk_tx);
                if (ret) {
                        dev_dbg(dev, "clk_get_by_name(clk_mac_speed) failed: %d", ret);
-                       goto err_free_clk_master_bus;
+                       goto err_release_resets;
                }
        }
 
@@ -393,8 +393,6 @@ static int eqos_probe_resources_rk(struct udevice *dev)
 
        return 0;
 
-err_free_clk_master_bus:
-       clk_free(&eqos->clk_master_bus);
 err_release_resets:
        reset_release_bulk(&data->resets);
 err_free:
@@ -412,8 +410,6 @@ static int eqos_remove_resources_rk(struct udevice *dev)
        if (dm_gpio_is_valid(&eqos->phy_reset_gpio))
                dm_gpio_free(dev, &eqos->phy_reset_gpio);
 
-       clk_free(&eqos->clk_tx);
-       clk_free(&eqos->clk_master_bus);
        reset_release_bulk(&data->resets);
        free(data);
 
index 8eeecbc4cf3b44d0262a0a97bf15d514e4042ad5..a265ce9df57fd97892cacfbef7c35f4fef1200fb 100644 (file)
@@ -777,7 +777,7 @@ static int ave_of_to_plat(struct udevice *dev)
                if (ret) {
                        dev_err(dev, "Failed to get clocks property: %d\n",
                                ret);
-                       goto out_clk_free;
+                       return ret;
                }
                priv->nclks++;
        }
@@ -823,9 +823,6 @@ static int ave_of_to_plat(struct udevice *dev)
 out_reset_free:
        while (--nr >= 0)
                reset_free(&priv->rst[nr]);
-out_clk_free:
-       while (--nc >= 0)
-               clk_free(&priv->clk[nc]);
 
        return ret;
 }
index 18a33c4c0e3c7c0ddb7a46dba11360319ccd1310..6da018c0f9d5d1c0adcd8f3aad7781e6fb6d8e2e 100644 (file)
@@ -948,7 +948,6 @@ static int am65_cpsw_probe_nuss(struct udevice *dev)
                 cpsw_common->bus_freq);
 
 out:
-       clk_free(&cpsw_common->fclk);
        power_domain_free(&cpsw_common->pwrdmn);
        return ret;
 }
index 1c10853940ac75b792118af0f8c4f90c029f3fab..a2fa446cb1c9c26042ff20cd25bc9ac880609e01 100644 (file)
@@ -98,8 +98,6 @@ static int bcm6318_usbh_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       clk_free(&clk);
-
        /* enable power domain */
        ret = power_domain_get(dev, &pwr_dom);
        if (ret < 0)
index ce6be3d7dab8ee34bb20cd77343daa7d4ae135e2..857fb575ef19ee0df57d9dfaf0398581983e8f3e 100644 (file)
@@ -62,8 +62,6 @@ static int bcm6348_usbh_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       clk_free(&clk);
-
        /* perform reset */
        ret = reset_get_by_index(dev, 0, &rst_ctl);
        if (ret < 0)
index d057f1f52e868313306b4a5337b6cde735bcf4e0..1a2870d51499818729d88204bfecfbd908a78cae 100644 (file)
@@ -137,8 +137,6 @@ static int bcm6368_usbh_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       clk_free(&clk);
-
 #if defined(CONFIG_POWER_DOMAIN)
        /* enable power domain */
        ret = power_domain_get(dev, &pwr_dom);
@@ -173,8 +171,6 @@ static int bcm6368_usbh_probe(struct udevice *dev)
                ret = clk_enable(&clk);
                if (ret < 0)
                        return ret;
-
-               clk_free(&clk);
        }
 
        mdelay(100);
index a69b6c9759444fc7f8ec48a58376b3a184fce957..faa1d9d6d378097a20ad9e5c3268c06fa3000a5d 100644 (file)
@@ -369,7 +369,6 @@ int meson_axg_mipi_dphy_probe(struct udevice *dev)
        ret = clk_enable(&priv->clk);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
                pr_err("failed to enable PHY clock\n");
-               clk_free(&priv->clk);
                return ret;
        }
 #endif
index 40a5da948dc15481976977b49d2d6f6a89a5dad6..1eaff410efa4710f3f61bff2a0d2a0f47092d193 100644 (file)
@@ -398,7 +398,6 @@ int meson_g12a_usb3_pcie_phy_probe(struct udevice *dev)
        ret = clk_enable(&priv->clk);
        if (ret && ret != -ENOENT && ret != -ENOTSUPP) {
                pr_err("failed to enable PHY clock\n");
-               clk_free(&priv->clk);
                return ret;
        }
 #endif
index 8f5e4a436615e345a13d09c51bb5199e89f23152..d633effa4042612e29e7b827e5b0fdc6acba1c5e 100644 (file)
@@ -203,7 +203,6 @@ int meson_gxl_usb2_phy_probe(struct udevice *dev)
        ret = clk_enable(&priv->clk);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP) {
                pr_err("failed to enable PHY clock\n");
-               clk_free(&priv->clk);
                return ret;
        }
 #endif
index 179409592460d0450f436f90068eb80ce39e8999..e528c4ec57934216f8067841ee20e6a370260d02 100644 (file)
@@ -172,7 +172,6 @@ static int rcar_gen2_phy_remove(struct udevice *dev)
        struct rcar_gen2_phy *priv = dev_get_priv(dev);
 
        clk_disable(&priv->clk);
-       clk_free(&priv->clk);
 
        return 0;
 }
index 7159e7e8716d56194193941d9698f459c10b8096..03c747b373b1aab317f760d4bd07c3083006dd57 100644 (file)
@@ -142,7 +142,6 @@ static int rcar_gen3_phy_remove(struct udevice *dev)
        struct rcar_gen3_phy *priv = dev_get_priv(dev);
 
        clk_disable(&priv->clk);
-       clk_free(&priv->clk);
 
        return 0;
 }
index 13f0a34268602418cd361384bead24d4456d72ac..ee35dfe142035b3e3a0a9c382fb6d0400ae9882e 100644 (file)
@@ -691,23 +691,19 @@ static int k210_pc_probe(struct udevice *dev)
 
        ret = clk_enable(&priv->clk);
        if (ret && ret != -ENOSYS && ret != -ENOTSUPP)
-               goto err;
+               return ret;
 
        ret = dev_read_phandle_with_args(dev, "canaan,k210-sysctl-power",
                                        NULL, 1, 0, &args);
         if (ret)
-               goto err;
+               return ret;
 
-       if (args.args_count != 1) {
-               ret = -EINVAL;
-               goto err;
-        }
+       if (args.args_count != 1)
+               return -EINVAL;
 
        priv->sysctl = syscon_node_to_regmap(args.node);
-       if (IS_ERR(priv->sysctl)) {
-               ret = PTR_ERR(priv->sysctl);
-               goto err;
-       }
+       if (IS_ERR(priv->sysctl))
+               return PTR_ERR(priv->sysctl);
 
        priv->power_offset = args.args[0];
 
@@ -728,10 +724,6 @@ static int k210_pc_probe(struct udevice *dev)
        }
 
        return 0;
-
-err:
-       clk_free(&priv->clk);
-       return ret;
 }
 
 static const struct udevice_id k210_pc_ids[] = {
index 6a721a934a74b2edd735892da7f746dc59e30507..e2d772c5ec78afead09a0d0f9191f71f00c7a974 100644 (file)
@@ -111,7 +111,7 @@ static int imx8mp_hsiomix_probe(struct udevice *dev)
 
        ret = power_domain_get_by_name(dev, &priv->pd_bus, "bus");
        if (ret < 0)
-               goto err_pd_bus;
+               return ret;
 
        ret = power_domain_get_by_name(dev, &priv->pd_usb, "usb");
        if (ret < 0)
@@ -133,8 +133,6 @@ err_pd_usb_phy1:
        power_domain_free(&priv->pd_usb);
 err_pd_usb:
        power_domain_free(&priv->pd_bus);
-err_pd_bus:
-       clk_free(&priv->clk_usb);
        return ret;
 }
 
index 1753283460dac047fa76761a2ff426ff95c1dc67..ec7584c3d70c3af3dcabe1fe96aa1ccf62eeb49c 100644 (file)
@@ -223,10 +223,8 @@ static int stm32_rtc_init(struct udevice *dev)
                return ret;
 
        ret = clk_enable(&clk);
-       if (ret) {
-               clk_free(&clk);
+       if (ret)
                return ret;
-       }
 
        rate = clk_get_rate(&clk);
 
@@ -275,10 +273,8 @@ static int stm32_rtc_init(struct udevice *dev)
 unlock:
        stm32_rtc_lock(dev);
 
-       if (ret) {
+       if (ret)
                clk_disable(&clk);
-               clk_free(&clk);
-       }
 
        return ret;
 }
@@ -298,17 +294,13 @@ static int stm32_rtc_probe(struct udevice *dev)
                return ret;
 
        ret = clk_enable(&clk);
-       if (ret) {
-               clk_free(&clk);
+       if (ret)
                return ret;
-       }
 
        ret = stm32_rtc_init(dev);
 
-       if (ret) {
+       if (ret)
                clk_disable(&clk);
-               clk_free(&clk);
-       }
 
        return ret;
 }
index 9853f49c94ff4a892c7071cc073a05fc4371e4d2..9827c006fa88b3df1944445917a5d5dc056e0ecc 100644 (file)
@@ -253,8 +253,6 @@ static int atmel_serial_enable_clk(struct udevice *dev)
 
        priv->usart_clk_rate = clk_rate;
 
-       clk_free(&clk);
-
        return 0;
 }
 #endif
index 2359656a239a5b39f8499d6d2eff2fefa2b11288..13bc51725cdebe26f5326b7eb20e83efaf51d400 100644 (file)
@@ -239,7 +239,6 @@ static int bcm6345_serial_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
        priv->uartclk = clk_get_rate(&clk);
-       clk_free(&clk);
 
        /* initialize serial */
        return bcm6345_serial_init(priv->base, priv->uartclk, CONFIG_BAUDRATE);
index a22623c316ed12a65817d4964d1c2a3578d52b6b..f4d96313b93114e51cda1c8f852e040990b914cd 100644 (file)
@@ -185,7 +185,6 @@ static int msm_uart_clk_init(struct udevice *dev)
                return ret;
 
        ret = clk_set_rate(&clk, clk_rate);
-       clk_free(&clk);
        if (ret < 0)
                return ret;
 
index 3c5d37ce0ab72c8acb61b5681433499e84cc10a3..0a03a9a254971291d675dc6b42f84c05f2f1d8ed 100644 (file)
@@ -155,7 +155,6 @@ static int pic32_uart_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
        priv->uartclk = clk_get_rate(&clk);
-       clk_free(&clk);
 
        /* initialize serial */
        return pic32_serial_init(priv->base, priv->uartclk, CONFIG_BAUDRATE);
index de9c14837cda8dc8bfb8df5dc2f7bcfffa7357c5..70cb242cd31efc22947ad2569cfe731f0735c4c1 100644 (file)
@@ -362,7 +362,6 @@ static int atcspi200_spi_get_clk(struct udevice *bus)
                return -EINVAL;
 
        ns->clock = clk_rate;
-       clk_free(&clk);
 
        return 0;
 }
index cb64119f9726cc57bd2c81086e064a5fcd594e5d..bd73e4fddf18033b352a69d6c69ce549f4f92bad 100644 (file)
@@ -877,7 +877,6 @@ static int atmel_qspi_set_gclk(struct udevice *bus, uint hz)
        ret = clk_enable(&gclk);
        if (ret)
                dev_err(bus, "Failed to enable QSPI generic clock\n");
-       clk_free(&gclk);
 
        return ret;
 }
@@ -1000,7 +999,7 @@ static int atmel_qspi_enable_clk(struct udevice *dev)
        ret = clk_enable(&pclk);
        if (ret) {
                dev_err(dev, "Failed to enable QSPI peripheral clock\n");
-               goto free_pclk;
+               return ret;
        }
 
        if (aq->caps->has_qspick) {
@@ -1008,32 +1007,27 @@ static int atmel_qspi_enable_clk(struct udevice *dev)
                ret = clk_get_by_name(dev, "qspick", &qspick);
                if (ret) {
                        dev_err(dev, "Missing QSPI peripheral clock\n");
-                       goto free_pclk;
+                       return ret;
                }
 
                ret = clk_enable(&qspick);
                if (ret)
                        dev_err(dev, "Failed to enable QSPI system clock\n");
-               clk_free(&qspick);
        } else if (aq->caps->has_gclk) {
                ret = clk_get_by_name(dev, "gclk", &gclk);
                if (ret) {
                        dev_err(dev, "Missing QSPI generic clock\n");
-                       goto free_pclk;
+                       return ret;
                }
 
                ret = clk_enable(&gclk);
                if (ret)
                        dev_err(dev, "Failed to enable QSPI system clock\n");
-               clk_free(&gclk);
        }
 
        aq->bus_clk_rate = clk_get_rate(&pclk);
        if (!aq->bus_clk_rate)
-               ret = -EINVAL;
-
-free_pclk:
-       clk_free(&pclk);
+               return -EINVAL;
 
        return ret;
 }
index aec6f4eca9ae3b4c298e319c8004aed19cb18a70..d4f0c4c448367e070782cf16a81fd16d64945451 100644 (file)
@@ -338,8 +338,6 @@ static int atmel_spi_enable_clk(struct udevice *bus)
 
        priv->bus_clk_rate = clk_rate;
 
-       clk_free(&clk);
-
        return 0;
 }
 
index 19d9a5ae23cde62a0ac0d3784dc32bf115b4864d..23ac5bb76c049d96a5f6e95e4cc2fc47ae0e180e 100644 (file)
@@ -581,8 +581,6 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
        if (ret < 0 && ret != -ENOSYS)
                return ret;
 
-       clk_free(&clk);
-
        /* get clock rate */
        ret = clk_get_by_name(dev, "pll", &clk);
        if (ret < 0 && ret != -ENOSYS)
@@ -590,8 +588,6 @@ static int bcm63xx_hsspi_probe(struct udevice *dev)
 
        priv->clk_rate = clk_get_rate(&clk);
 
-       clk_free(&clk);
-
        /* perform reset */
        ret = reset_get_by_index(dev, 0, &rst_ctl);
        if (ret >= 0) {
index 0600d56c69e7b952a36e9b40bcee8a573394788c..889ac1f966e3b96a4354e9f794c91b683a43c189 100644 (file)
@@ -391,8 +391,6 @@ static int bcm63xx_spi_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
 
-       clk_free(&clk);
-
        /* perform reset */
        ret = reset_get_by_index(dev, 0, &rst_ctl);
        if (ret < 0)
index fbe315a7d45d4a2a8e4818c769308d7893eee8cb..af45882db0a70f6d80cf42609141d2d6bdc1426c 100644 (file)
@@ -375,8 +375,6 @@ static int bcmbca_hsspi_probe(struct udevice *dev)
        if (ret < 0 && ret != -ENOSYS)
                return ret;
 
-       clk_free(&clk);
-
        /* get clock rate */
        ret = clk_get_by_name(dev, "pll", &clk);
        if (ret < 0 && ret != -ENOSYS)
@@ -384,8 +382,6 @@ static int bcmbca_hsspi_probe(struct udevice *dev)
 
        priv->clk_rate = clk_get_rate(&clk);
 
-       clk_free(&clk);
-
        /* initialize hardware */
        writel(0, priv->regs + SPI_IR_MASK_REG);
 
index dfc74c882d2de6d030b7d6912c3b1e1081360107..f4593c47b8c557f892afc8ee6e39e6c4c11a86a4 100644 (file)
@@ -236,7 +236,6 @@ static int cadence_spi_probe(struct udevice *bus)
 #endif
                } else {
                        priv->ref_clk_hz = clk_get_rate(&clk);
-                       clk_free(&clk);
                        if (IS_ERR_VALUE(priv->ref_clk_hz))
                                return priv->ref_clk_hz;
                }
index 98908c5217fd600b0712378965055325911ec84d..22a79da2333eb2161ef5ee69aaf40c5f800e38d7 100644 (file)
@@ -319,7 +319,6 @@ __weak int dw_spi_get_clk(struct udevice *bus, ulong *rate)
 
 err_rate:
        clk_disable(&priv->clk);
-       clk_free(&priv->clk);
 
        return -EINVAL;
 }
@@ -743,10 +742,6 @@ static int dw_spi_remove(struct udevice *bus)
        ret = clk_disable(&priv->clk);
        if (ret)
                return ret;
-
-       clk_free(&priv->clk);
-       if (ret)
-               return ret;
 #endif
        return 0;
 }
index cca4debb4126e9f7d073313a9beb910c49c5515d..943bf6986f15f05ff1da8795d190327dd3a0e74e 100644 (file)
@@ -343,15 +343,6 @@ static int amlogic_spifc_a1_probe(struct udevice *dev)
        return 0;
 }
 
-static int amlogic_spifc_a1_remove(struct udevice *dev)
-{
-       struct amlogic_spifc_a1 *spifc = dev_get_priv(dev);
-
-       clk_free(&spifc->clk);
-
-       return 0;
-}
-
 static const struct udevice_id meson_spifc_ids[] = {
        { .compatible = "amlogic,a1-spifc", },
        { }
@@ -379,6 +370,5 @@ U_BOOT_DRIVER(meson_spifc_a1) = {
        .of_match       = meson_spifc_ids,
        .ops            = &amlogic_spifc_a1_ops,
        .probe          = amlogic_spifc_a1_probe,
-       .remove         = amlogic_spifc_a1_remove,
        .priv_auto      = sizeof(struct amlogic_spifc_a1),
 };
index 52882e8b263b7918b59ee93072146f95dc183840..bba2383a11167f300a3200d0a567f0d6bf0ee3ab 100644 (file)
@@ -296,15 +296,6 @@ static int mvebu_spi_of_to_plat(struct udevice *bus)
        return 0;
 }
 
-static int mvebu_spi_remove(struct udevice *bus)
-{
-       struct mvebu_spi_plat *plat = dev_get_plat(bus);
-
-       clk_free(&plat->clk);
-
-       return 0;
-}
-
 static const struct dm_spi_ops mvebu_spi_ops = {
        .xfer           = mvebu_spi_xfer,
        .set_speed      = mvebu_spi_set_speed,
@@ -328,5 +319,4 @@ U_BOOT_DRIVER(mvebu_spi) = {
        .of_to_plat = mvebu_spi_of_to_plat,
        .plat_auto      = sizeof(struct mvebu_spi_plat),
        .probe = mvebu_spi_probe,
-       .remove = mvebu_spi_remove,
 };
index 39620310218291747c911dc7fad2a17b7f3cb38b..7d5f101a76621c32a51ae779250671e5d9a62cbf 100644 (file)
@@ -1148,7 +1148,6 @@ static int apseed_spi_of_to_plat(struct udevice *bus)
        }
 
        plat->hclk_rate = clk_get_rate(&hclk);
-       clk_free(&hclk);
 
        dev_dbg(bus, "ctrl_base = 0x%x, ahb_base = 0x%p, size = 0x%llx\n",
                (u32)priv->regs, plat->ahb_base, (fdt64_t)plat->ahb_sz);
index 82f6ed783f9e8e71033dcf71e39de1dc1dfbb309..ddb410a94c010360879fd74637e0cb10060e9aed 100644 (file)
@@ -526,22 +526,16 @@ static int stm32_spi_of_to_plat(struct udevice *dev)
 
        ret = reset_get_by_index(dev, 0, &plat->rst_ctl);
        if (ret < 0)
-               goto clk_err;
+               return ret;
 
        ret = gpio_request_list_by_name(dev, "cs-gpios", plat->cs_gpios,
                                        ARRAY_SIZE(plat->cs_gpios), 0);
        if (ret < 0) {
                dev_err(dev, "Can't get %s cs gpios: %d", dev->name, ret);
-               ret = -ENOENT;
-               goto clk_err;
+               return -ENOENT;
        }
 
        return 0;
-
-clk_err:
-       clk_free(&plat->clk);
-
-       return ret;
 }
 
 static int stm32_spi_probe(struct udevice *dev)
@@ -610,7 +604,6 @@ static int stm32_spi_probe(struct udevice *dev)
 
 clk_err:
        clk_disable(&plat->clk);
-       clk_free(&plat->clk);
 
        return ret;
 };
@@ -630,13 +623,7 @@ static int stm32_spi_remove(struct udevice *dev)
 
        reset_free(&plat->rst_ctl);
 
-       ret = clk_disable(&plat->clk);
-       if (ret < 0)
-               return ret;
-
-       clk_free(&plat->clk);
-
-       return ret;
+       return clk_disable(&plat->clk);
 };
 
 static const struct dm_spi_ops stm32_spi_ops = {
index 6cd25251f94522aa16279bd6dc0a357a78f4c1ed..0607f751ca708792bb28d36aa4d641919a53b69c 100644 (file)
@@ -74,8 +74,6 @@ static int dw_apb_timer_probe(struct udevice *dev)
                        return ret;
 
                uc_priv->clock_rate = clk_get_rate(&clk);
-
-               clk_free(&clk);
        }
 
        /* init timer */
index 3ec729d2c43a1eaee0a4ecb827646ed5b4fa5154..3bf0d4647b58aa2de28b4a88e973436c09b2fac1 100644 (file)
@@ -49,8 +49,6 @@ static int ostm_probe(struct udevice *dev)
                return ret;
 
        uc_priv->clock_rate = clk_get_rate(&clk);
-
-       clk_free(&clk);
 #else
        uc_priv->clock_rate = get_board_sys_clk() / 2;
 #endif
index 196035215a6e6023ce5f22e23800ee0f46be89c7..1a3e9350c46dfe3c3e86cccd747ce6f4e98c7c06 100644 (file)
@@ -361,10 +361,8 @@ static int dwc3_meson_g12a_clk_init(struct dwc3_meson_g12a *priv)
 
 #if CONFIG_IS_ENABLED(CLK)
        ret = clk_enable(&priv->clk);
-       if (ret) {
-               clk_free(&priv->clk);
+       if (ret)
                return ret;
-       }
 #endif
 
        return 0;
index cbe8aaa005b34cbf248354744bb2eb806d990a6a..2ce915701a857dde9427cd0ed0be4fbbd2d30e1e 100644 (file)
@@ -284,10 +284,8 @@ static int dwc3_meson_gxl_clk_init(struct dwc3_meson_gxl *priv)
 
 #if CONFIG_IS_ENABLED(CLK)
        ret = clk_enable(&priv->clk);
-       if (ret) {
-               clk_free(&priv->clk);
+       if (ret)
                return ret;
-       }
 #endif
 
        return 0;
index fba3595e10fc7fca088d7d1d7bac94a6e4b14c17..c6d50fd4551ab5682fce0e4393727c82a10c36f6 100644 (file)
@@ -70,13 +70,7 @@ static int ehci_atmel_enable_clk(struct udevice *dev)
        if (ret)
                return -EINVAL;
 
-       ret = clk_enable(&clk);
-       if (ret)
-               return ret;
-
-       clk_free(&clk);
-
-       return 0;
+       return clk_enable(&clk);
 }
 
 static int ehci_atmel_probe(struct udevice *dev)
index 33c4a911a090be1fa26d54217c192588ff8ebe53..d3d73d238442bba552f76d05375103d4f1960a9a 100644 (file)
@@ -115,7 +115,6 @@ static int ohci_da8xx_probe(struct udevice *dev)
                        err = clk_enable(&priv->clocks[i]);
                        if (err) {
                                dev_err(dev, "failed to enable clock %d\n", i);
-                               clk_free(&priv->clocks[i]);
                                goto clk_err;
                        }
                        priv->clock_count++;
index 5fc7afb7d2158c674c353900a53c0ba4d4dc8dbd..fedcf786929542ce7589802550b1f3fc7248dfb0 100644 (file)
@@ -90,7 +90,7 @@ static int xhci_rcar_probe(struct udevice *dev)
        ret = clk_enable(&plat->clk);
        if (ret) {
                dev_err(dev, "Failed to enable USB3 clock\n");
-               goto err_clk;
+               return ret;
        }
 
        ctx->hcd = (struct xhci_hccr *)plat->hcd_base;
@@ -114,8 +114,6 @@ static int xhci_rcar_probe(struct udevice *dev)
 
 err_fw:
        clk_disable(&plat->clk);
-err_clk:
-       clk_free(&plat->clk);
        return ret;
 }
 
@@ -127,7 +125,6 @@ static int xhci_rcar_deregister(struct udevice *dev)
        ret = xhci_deregister(dev);
 
        clk_disable(&plat->clk);
-       clk_free(&plat->clk);
 
        return ret;
 }
index 2bf19a6684b5c788be4db07fa2d7b486a20ed2e3..652ba1418018a154ecf069fbbdd6b1140b06c864 100644 (file)
@@ -62,8 +62,6 @@ static int at91_hlcdc_enable_clk(struct udevice *dev)
 
        priv->clk_rate = clk_rate;
 
-       clk_free(&clk);
-
        return 0;
 }
 
index cbcdb99e1f07adc2747b9187a0cbf5d02a153272..dbb2f538617178afa6305f1ef966fcf612bb4856 100644 (file)
@@ -360,25 +360,18 @@ static int malidp_probe(struct udevice *dev)
 
        err = malidp_setup_mode(priv, &timings);
        if (err)
-               goto fail_timings;
+               return err;
 
        malidp_setup_layer(priv, &timings, MALIDP_LAYER_LV1,
                           (phys_addr_t)uc_plat->base);
 
        err = malidp_leave_config(priv);
        if (err)
-               goto fail_timings;
+               return err;
 
        malidp_set_configvalid(priv);
 
        return 0;
-
-fail_timings:
-       clk_free(&priv->aclk);
-fail_aclk:
-       clk_free(&priv->pxlclk);
-
-       return err;
 }
 
 static int malidp_bind(struct udevice *dev)
index 327ae7871252682eabd09151771ba947a050b151..8bedee55ad429bbffd69b76b45a6d797abcf32c9 100644 (file)
@@ -67,10 +67,8 @@ static int rk3288_clk_config(struct udevice *dev)
         * monitor wants
         */
        ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
-       if (ret >= 0) {
+       if (ret >= 0)
                ret = clk_set_rate(&clk, 384000000);
-               clk_free(&clk);
-       }
        if (ret < 0) {
                debug("%s: Failed to set clock in source device '%s': ret=%d\n",
                      __func__, uc_plat->src_dev->name, ret);
index 3697d582510a89cfaa3126642c207e50daec6a73..dbd70ad583ab553f379d5947181d542a87b8c5db 100644 (file)
@@ -1095,20 +1095,16 @@ static int rk_edp_probe(struct udevice *dev)
 
        if (edp_data->chip_type == RK3288_DP) {
                ret = clk_get_by_index(dev, 1, &clk);
-               if (ret >= 0) {
+               if (ret >= 0)
                        ret = clk_set_rate(&clk, 0);
-                       clk_free(&clk);
-               }
                if (ret) {
                        debug("%s: Failed to set EDP clock: ret=%d\n", __func__, ret);
                        return ret;
                }
        }
        ret = clk_get_by_index(uc_plat->src_dev, 0, &clk);
-       if (ret >= 0) {
+       if (ret >= 0)
                ret = clk_set_rate(&clk, 192000000);
-               clk_free(&clk);
-       }
        if (ret < 0) {
                debug("%s: Failed to set clock in source device '%s': ret=%d\n",
                      __func__, uc_plat->src_dev->name, ret);
index 447a22d3b36528bc7d69703ece97ca8234848da4..b22e0ee06a4e5cf4386a4fc91feaf0a756963273 100644 (file)
@@ -124,13 +124,11 @@ static int designware_wdt_probe(struct udevice *dev)
 
        ret = clk_enable(&clk);
        if (ret)
-               goto err;
+               return ret;
 
        priv->clk_khz = clk_get_rate(&clk) / 1000;
-       if (!priv->clk_khz) {
-               ret = -EINVAL;
-               goto err;
-       }
+       if (!priv->clk_khz)
+               return -EINVAL;
 #else
        priv->clk_khz = CFG_DW_WDT_CLOCK_KHZ;
 #endif
@@ -139,21 +137,15 @@ static int designware_wdt_probe(struct udevice *dev)
            ofnode_read_prop(dev_ofnode(dev), "resets", &ret)) {
                ret = reset_get_bulk(dev, &priv->resets);
                if (ret)
-                       goto err;
+                       return ret;
 
                ret = reset_deassert_bulk(&priv->resets);
                if (ret)
-                       goto err;
+                       return ret;
        }
 
        /* reset to disable the watchdog */
        return designware_wdt_stop(dev);
-
-err:
-#if CONFIG_IS_ENABLED(CLK)
-       clk_free(&clk);
-#endif
-       return ret;
 }
 
 static const struct wdt_ops designware_wdt_ops = {
index 6ab005813f923d5bd03af8bc794bb8bf6b0ef550..01a35b3ab30c7803fadd791fec918de8955a1965 100644 (file)
@@ -98,10 +98,8 @@ static int amlogic_wdt_probe(struct udevice *dev)
                return ret;
 
        ret = clk_enable(&clk);
-       if (ret) {
-               clk_free(&clk);
+       if (ret)
                return ret;
-       }
 
        /* Setup with 1ms timebase */
        writel(((clk_get_rate(&clk) / 1000) & GXBB_WDT_CTRL_DIV_MASK) |
index ea5f6bd6f792c6b6b5a598f0a9c2f6ea55f77869..af23e4f347533b0426053685bf11714fd2d0620e 100644 (file)
@@ -247,19 +247,6 @@ static inline struct clk *devm_clk_get_optional(struct udevice *dev,
  */
 int clk_release_all(struct clk *clk, unsigned int count);
 
-/**
- * devm_clk_put        - "free" a managed clock source
- * @dev: device used to acquire the clock
- * @clk: clock source acquired with devm_clk_get()
- *
- * Note: drivers must ensure that all clk_enable calls made on this
- * clock source are balanced by clk_disable calls prior to calling
- * this function.
- *
- * clk_put should not be called from within interrupt context.
- */
-void devm_clk_put(struct udevice *dev, struct clk *clk);
-
 #else
 
 static inline int clk_get_by_phandle(struct udevice *dev, const
@@ -313,10 +300,6 @@ static inline int clk_release_all(struct clk *clk, unsigned int count)
 {
        return -ENOSYS;
 }
-
-static inline void devm_clk_put(struct udevice *dev, struct clk *clk)
-{
-}
 #endif
 
 /**
@@ -424,10 +407,6 @@ static inline int clk_release_bulk(struct clk_bulk *bulk)
        return clk_release_all(bulk->clks, bulk->count);
 }
 
-static inline void clk_free(struct clk *clk)
-{
-}
-
 #if CONFIG_IS_ENABLED(CLK)
 /**
  * clk_request() - Request a clock by provider-specific ID.