* [RESEND] [PATCH 1/1] block: Fix id of xsysace with missing port-number
@ 2013-05-02 20:27 Gernot Vormayr
2013-05-07 21:40 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Gernot Vormayr @ 2013-05-02 20:27 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jens Axboe, Andrew Morton
Cc: linux-kernel, Gernot Vormayr
If the port number is missing from the device-tree the device gets
named xs` instead of xsa. This fixes the check for missing ids.
Tested on ml507 board.
Signed-off-by: Gernot Vormayr <gvormayr@gmail.com>
---
drivers/block/xsysace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 1f38643..6b5807a 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -1161,8 +1161,7 @@ static int ace_probe(struct platform_device *dev)
dev_dbg(&dev->dev, "ace_probe(%p)\n", dev);
/* device id and bus width */
- of_property_read_u32(dev->dev.of_node, "port-number", &id);
- if (id < 0)
+ if (of_property_read_u32(dev->dev.of_node, "port-number", &id))
id = 0;
if (of_find_property(dev->dev.of_node, "8-bit", NULL))
bus_width = ACE_BUS_WIDTH_8;
--
1.8.2.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [RESEND] [PATCH 1/1] block: Fix id of xsysace with missing port-number
2013-05-02 20:27 [RESEND] [PATCH 1/1] block: Fix id of xsysace with missing port-number Gernot Vormayr
@ 2013-05-07 21:40 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2013-05-07 21:40 UTC (permalink / raw)
To: Gernot Vormayr
Cc: Greg Kroah-Hartman, Jens Axboe, linux-kernel, Grant Likely, Rob Herring
On Thu, 2 May 2013 22:27:45 +0200 Gernot Vormayr <gvormayr@gmail.com> wrote:
> If the port number is missing from the device-tree the device gets
> named xs` instead of xsa. This fixes the check for missing ids.
>
> Tested on ml507 board.
>
> Signed-off-by: Gernot Vormayr <gvormayr@gmail.com>
> ---
> drivers/block/xsysace.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
> index 1f38643..6b5807a 100644
> --- a/drivers/block/xsysace.c
> +++ b/drivers/block/xsysace.c
> @@ -1161,8 +1161,7 @@ static int ace_probe(struct platform_device *dev)
> dev_dbg(&dev->dev, "ace_probe(%p)\n", dev);
>
> /* device id and bus width */
> - of_property_read_u32(dev->dev.of_node, "port-number", &id);
> - if (id < 0)
> + if (of_property_read_u32(dev->dev.of_node, "port-number", &id))
> id = 0;
> if (of_find_property(dev->dev.of_node, "8-bit", NULL))
> bus_width = ACE_BUS_WIDTH_8;
err, yes. If of_property_read_u32() fails to locate the property, `id'
remains unaltered. That code appears to believe that
of_property_read_u32() puts its errno into `id'.
AFAICT, it is always a bug to fail to check the of_property_read()
return value (unless the caller somehow *knows* the property exists?).
Perhaps these functions should be marked __must_check to locate and
prevent such bugs.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-07 21:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-02 20:27 [RESEND] [PATCH 1/1] block: Fix id of xsysace with missing port-number Gernot Vormayr
2013-05-07 21:40 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).