netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2] sh_eth: check TSU registers ioremap() error
@ 2013-03-19 23:41 Sergei Shtylyov
  2013-03-20 16:23 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-03-19 23:41 UTC (permalink / raw)
  To: netdev; +Cc: nobuhiro.iwamatsu.yj

One must check the result of ioremap() -- in this case it prevents potential
kernel oops when initializing TSU registers further on...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
 drivers/net/ethernet/renesas/sh_eth.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: renesas/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- renesas.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ renesas/drivers/net/ethernet/renesas/sh_eth.c
@@ -2446,6 +2446,11 @@ static int sh_eth_drv_probe(struct platf
 		}
 		mdp->tsu_addr = ioremap(rtsu->start,
 					resource_size(rtsu));
+		if (mdp->tsu_addr == NULL) {
+			ret = -ENOMEM;
+			dev_err(&pdev->dev, "TSU ioremap failed.\n");
+			goto out_release;
+		}
 		mdp->port = devno % 2;
 		ndev->features = NETIF_F_HW_VLAN_FILTER;
 	}

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-20 18:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-19 23:41 [PATCH 2/2] sh_eth: check TSU registers ioremap() error Sergei Shtylyov
2013-03-20 16:23 ` David Miller
2013-03-20 19:04   ` Sergei Shtylyov
2013-03-20 19:16     ` Sergei Shtylyov
2013-03-20 18:20       ` Denis Kirjanov
2013-03-20 19:45         ` Sergei Shtylyov

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).