lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1de8aa41-8001-cf46-026c-b00f8df0b9a3@gmail.com>
Date:   Fri, 14 Aug 2020 19:47:02 +0300
From:   Dmitry Osipenko <digetx@...il.com>
To:     Chanwoo Choi <cw00.choi@...sung.com>,
        Thierry Reding <thierry.reding@...il.com>,
        Jonathan Hunter <jonathanh@...dia.com>,
        Georgi Djakov <georgi.djakov@...aro.org>,
        Rob Herring <robh+dt@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Peter De Schrijver <pdeschrijver@...dia.com>,
        MyungJoo Ham <myungjoo.ham@...sung.com>,
        Kyungmin Park <kyungmin.park@...sung.com>,
        Mikko Perttunen <cyndis@...si.fi>
Cc:     linux-tegra@...r.kernel.org, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v5 13/36] PM / devfreq: tegra30: Use MC timings for
 building OPP table

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.

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

Thanks!

...
>>  static const struct of_device_id tegra_devfreq_of_match[] = {
>> -	{ .compatible = "nvidia,tegra30-actmon" },
>> -	{ .compatible = "nvidia,tegra124-actmon" },
>> +	{ .compatible = "nvidia,tegra30-actmon",  .data = &tegra30_soc, },
>> +	{ .compatible = "nvidia,tegra124-actmon", .data = &tegra124_soc, },
>>  	{ },
>>  };


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ