[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A765B125120D1346A63912DDE6D8B6315E6D82@NTXXIAMBX02.xacn.micron.com>
Date: Thu, 16 Oct 2014 00:52:02 +0000
From: bpqw <bpqw@...ron.com>
To: Marek Vasut <marex@...x.de>
CC: "dwmw2@...radead.org" <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
"shijie8@...il.com" <shijie8@...il.com>,
"geert+renesas@...der.be" <geert+renesas@...der.be>,
"grmoore@...era.com" <grmoore@...era.com>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/1 v2] driver:mtd:spi-nor:fix spi_nor_scan overwrite
platform ID point
>Won't $info contain an undefined value in case the newly added condition isn't met ? The old code initialized $info to a certain value always, the new code does not do that.
Hi,Marek Vasut
Thanks.the $info has been defined before as below:
info = (void *)id->driver_data;
Unless id has not been initialized before.If having the following situation,
current linux codes will not properly match platform device data:
For example:
const struct spi_device_id spi_nor_ids[] = {
......
......
......
{ "n25q064", INFO(0x20ba17, 0, 64 * 1024, 128, 0) },
{ "n25q128a11", INFO(0x20bb18, 0, 64 * 1024, 256, 0) },//former right platform point will be overwrote by this data info.
{ "n25q128a13", INFO(0x20bb18, 0x1234, 64 * 1024, 512, SECT_4K) },//this is the right platform data,I want to match this data info.
{ "n25q256a", INFO(0x20ba19, 0, 64 * 1024, 512, SECT_4K) },
{ "n25q512a", INFO(0x20bb20, 0, 64 * 1024, 1024, SECT_4K) },
......
......
......
};
EXPORT_SYMBOL_GPL(spi_nor_ids);
Maybe my patch should take into account that ID is NULL,
I want to change my patch following, could you please give me some suggestions:
struct flash_info *tmpinfo;
tmpinfo = (void *)jid->driver_data;
if (id == NULL || tmpinfo->jedec_id != info->jedec_id ||
(info->ext_id != 0 && tmpinfo->ext_id != info->ext_id)) {
dev_warn(dev, "found %s, expected %s\n",
jid->name, id->name);
id = jid;
info = (void *)jid->driver_data;
}
Powered by blists - more mailing lists