[PATCH v5 13/36] PM / devfreq: tegra30: Use MC timings for building OPP table

Chanwoo Choi cw00.choi at samsung.com
Fri Aug 28 01:47:46 UTC 2020


Hi,

On 8/15/20 1:47 AM, Dmitry Osipenko wrote:
> 14.08.2020 05:02, Chanwoo Choi пишет:
>> Hi Dmitry,
>>
>> I add the minor comment. Except of some comments, it looks good to me.
> 
> Hello, Chanwoo! Thank you for the review!
> 
> ...
>>> +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",
>>> +};
> .
>>> +	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.

> 
>>> +
>>> +	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


More information about the dri-devel mailing list