[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aa53da4f-205d-cfa1-c85c-00e82e928bbc@axentia.se>
Date: Wed, 21 Sep 2016 10:25:08 +0200
From: Peter Rosin <peda@...ntia.se>
To: Alexander Shiyan <shc_work@...l.ru>, Yangbo Lu <yangbo.lu@....com>
CC: Mark Rutland <mark.rutland@....com>,
Xiaobo Xie <xiaobo.xie@....com>,
Minghuan Lian <minghuan.lian@....com>,
<linux-i2c@...r.kernel.org>, <linux-clk@...r.kernel.org>,
Qiang Zhao <qiang.zhao@....com>,
Russell King <linux@....linux.org.uk>,
Bhupesh Sharma <bhupesh.sharma@...escale.com>,
Joerg Roedel <joro@...tes.org>,
Jochen Friedrich <jochen@...am.de>,
"Claudiu Manoil" <claudiu.manoil@...escale.com>,
<devicetree@...r.kernel.org>, "Kumar Gala" <galak@...eaurora.org>,
Rob Herring <robh+dt@...nel.org>,
"Santosh Shilimkar" <ssantosh@...nel.org>,
<linux-arm-kernel@...ts.infradead.org>, <netdev@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, Leo Li <leoyang.li@....com>,
<iommu@...ts.linux-foundation.org>,
<linuxppc-dev@...ts.ozlabs.org>, <linux-mmc@...r.kernel.org>,
<ulf.hansson@...aro.org>, Scott Wood <oss@...error.net>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [v12, 7/8] base: soc: introduce soc_device_match() interface
On 2016-09-21 09:56, Alexander Shiyan wrote:
>> Среда, 21 сентября 2016, 9:57 +03:00 от Yangbo Lu <yangbo.lu@....com>:
>>
>> From: Arnd Bergmann < arnd@...db.de >
>>
>> We keep running into cases where device drivers want to know the exact
>> version of the a SoC they are currently running on. In the past, this has
>> usually been done through a vendor specific API that can be called by a
>> driver, or by directly accessing some kind of version register that is
>> not part of the device itself but that belongs to a global register area
>> of the chip.
> ...
>> +const struct soc_device_attribute *soc_device_match(
>> +const struct soc_device_attribute *matches)
>> +{
>> +int ret = 0;
>> +
>> +if (!matches)
>> +return NULL;
>> +
>> +while (!ret) {
>> +if (!(matches->machine || matches->family ||
>> + matches->revision || matches->soc_id))
>> +break;
>> +ret = bus_for_each_dev(&soc_bus_type, NULL, (void *)matches,
>> + soc_device_match_one);
>> +if (!ret)
>> +matches++;
>
> So, what happen if next "matches" (after increment) will be NULL?
A crash?
> I think you should use while(matches) at the start of this procedure.
*arrgh*
*If* matches wrap, you indeed have *big* problems. *Elsewhere*
Hint: Please read the review comments on the previous version of this
series [1] before commenting further.
Cheers,
Peter
[1] https://www.mail-archive.com/netdev@vger.kernel.org/msg126617.html
Powered by blists - more mailing lists