};
 
-static struct clk *tx_macro_register_mclk_output(struct tx_macro *tx)
+static int tx_macro_register_mclk_output(struct tx_macro *tx)
 {
        struct device *dev = tx->dev;
-       struct device_node *np = dev->of_node;
        const char *parent_clk_name = NULL;
        const char *clk_name = "lpass-tx-mclk";
        struct clk_hw *hw;
        init.num_parents = 1;
        tx->hw.init = &init;
        hw = &tx->hw;
-       ret = clk_hw_register(tx->dev, hw);
+       ret = devm_clk_hw_register(dev, hw);
        if (ret)
-               return ERR_PTR(ret);
-
-       of_clk_add_provider(np, of_clk_src_simple_get, hw->clk);
+               return ret;
 
-       return NULL;
+       return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, hw);
 }
 
 static const struct snd_soc_component_driver tx_macro_component_drv = {
        if (ret)
                return ret;
 
-       tx_macro_register_mclk_output(tx);
+       ret = tx_macro_register_mclk_output(tx);
+       if (ret)
+               goto err;
 
        ret = devm_snd_soc_register_component(dev, &tx_macro_component_drv,
                                              tx_macro_dai,
 {
        struct tx_macro *tx = dev_get_drvdata(&pdev->dev);
 
-       of_clk_del_provider(pdev->dev.of_node);
-
        clk_bulk_disable_unprepare(TX_NUM_CLKS_MAX, tx->clks);
 
        return 0;