Messages in this thread Patch in this message | | | From | Alexey Brodkin <> | Subject | [PATCH] drivers/block/xsysace - revert "id" type from "u32" back to "int" | Date | Thu, 7 Feb 2013 17:05:31 +0400 |
| |
On addition of new device specified in devicetree device's "id" is set by default to "-1" (it's in "of_device_add").
During probing of xsysace itself driver wants to determine his instance number (used later for example for device naming). It is done simply by reading "dev->id" (which is "-1" by default).
Then driver tries to get "id" from devicetree description reading specific "port-number" property with "of_property_read_u32". And if no property "port-number" was found "id" won't be changed (so if it was "-1" it remains the same).
And later we check it with "if (id < 0) id = 0;" to escape negative values.
But if "id" is "u32" it's always > 0 and later this value "-1" is used for example for generation of device name. And instead of "xsa" it will be "xs'" (ASCII "'" is "a" - 1). Which I believe is not expected.
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> --- drivers/block/xsysace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 1f38643..32cc0a1 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c @@ -1154,7 +1154,7 @@ static int ace_probe(struct platform_device *dev) { resource_size_t physaddr = 0; int bus_width = ACE_BUS_WIDTH_16; /* FIXME: should not be hard coded */ - u32 id = dev->id; + int id = dev->id; int irq = 0; int i; -- 1.7.10.4
| |