gianfar: Fix potential oops during OF address translation
authorAnton Vorontsov <avorontsov@mvista.com>
Fri, 23 Apr 2010 07:12:44 +0000 (07:12 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Apr 2010 23:20:25 +0000 (16:20 -0700)
gianfar driver may pass NULL pointer to the of_translate_address(),
which may lead to a kernel oops. Fix this by using of_iomap(), which
is also much simpler and shorter.

Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gianfar.c

index 080d1cea5b265704819d54b1c60e96393d1b7749..df49af382159907ab6268a17f99c4a041d26b766 100644 (file)
@@ -549,12 +549,8 @@ static int gfar_parse_group(struct device_node *np,
                struct gfar_private *priv, const char *model)
 {
        u32 *queue_mask;
-       u64 addr, size;
-
-       addr = of_translate_address(np,
-                       of_get_address(np, 0, &size, NULL));
-       priv->gfargrp[priv->num_grps].regs = ioremap(addr, size);
 
+       priv->gfargrp[priv->num_grps].regs = of_iomap(np, 0);
        if (!priv->gfargrp[priv->num_grps].regs)
                return -ENOMEM;