Commit 7ce97d4f authored by Anton Vorontsov's avatar Anton Vorontsov Committed by David S. Miller

gianfar: Fix potential oops during OF address translation

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: default avatarAnton Vorontsov <avorontsov@mvista.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3b1fd3e5
...@@ -549,12 +549,8 @@ static int gfar_parse_group(struct device_node *np, ...@@ -549,12 +549,8 @@ static int gfar_parse_group(struct device_node *np,
struct gfar_private *priv, const char *model) struct gfar_private *priv, const char *model)
{ {
u32 *queue_mask; 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) if (!priv->gfargrp[priv->num_grps].regs)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment