Re: [PATCH v2] gpio: rockchip: support 'clock-names' from dt nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 23, 2024 at 11:43:10AM +0800, Ye Zhang wrote:
> Added support for retrieving clocks using 'clock-names' from dt nodes

...

> +	bank->clk = devm_clk_get(dev, "bus");
> +	if (IS_ERR(bank->clk)) {
> +		bank->clk = of_clk_get(dev->of_node, 0);
> +		if (IS_ERR(bank->clk)) {

> +			dev_err(dev, "fail to get apb clock\n");
> +			return PTR_ERR(bank->clk);

			return dev_err_probe(...);

> +		}
> +	}

...

> +	clk_prepare_enable(bank->clk);
> +	clk_prepare_enable(bank->db_clk);

Any of this may fail. You perhaps want

	bank->...clk = devm_clk_get_enabled(dev, "...");

Not sure for the fallback case (of_clk_get() should be killed as we almost done
in GPIO library for GPIO APIs).

...

> +err_unlock:
> +	mutex_unlock(&bank->deferred_lock);

Don't you want to use guard()/scoped_guard() at some point?

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux