Re: [PATCH v5 13/36] PM / devfreq: tegra30: Use MC timings for building OPP table
From: Chanwoo Choi <cw00.choi@samsung.com>
Date: 2020-08-28 01:35:36
Also in:
dri-devel, linux-pm, linux-tegra, lkml
Hi, On 8/15/20 1:47 AM, Dmitry Osipenko wrote:
14.08.2020 05:02, Chanwoo Choi пишет:quoted
Hi Dmitry, I add the minor comment. Except of some comments, it looks good to me.Hello, Chanwoo! Thank you for the review! ...quoted
quoted
+struct tegra_devfreq_soc_data { + const char *mc_compatible; +}; + +static const struct tegra_devfreq_soc_data tegra30_soc = { + .mc_compatible = "nvidia,tegra30-mc", +}; + +static const struct tegra_devfreq_soc_data tegra124_soc = { + .mc_compatible = "nvidia,tegra124-mc", +};.quoted
quoted
+ soc_data = of_device_get_match_data(&pdev->dev);I think that better to check whether 'soc_data' is not NULL.It's a quite common misconception among kernel developers that of_device_get_match_data() may "accidentally" return NULL, but it couldn't if every driver's of_match[] entry has a non-NULL .data field and because the OF-matching already happened at the driver's probe-time [1], which is the case of this driver. [1] https://elixir.bootlin.com/linux/v5.8/source/drivers/of/device.c#L189 Hence the NULL-checking is unnecessary. When I first encountered the of_device_get_match_data(), I was also thinking that adding the NULL-checks is a good idea, but later on somebody pointed out to me (maybe Thierry) that it's unnecessary to do.
OK. Thanks.
quoted
quoted
+ + mc = tegra_get_memory_controller(soc_data->mc_compatible); + if (IS_ERR(mc)) + return PTR_ERR(mc);You better to add error log.In practice we should get only -EPROBE_DEFER here ever. I'll consider adding the message in the next revision, at least just for consistency.
In order to handle -EPROBE_DEFER, recommend the using of dev_err_probe(). (snip) -- Best Regards, Chanwoo Choi Samsung Electronics