mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* dm9000 patches
@ 2013-12-18 15:45 Sascha Hauer
  2013-12-18 15:45 ` [PATCH 1/2] net: dm9k: Fix resource sizes in add_dm9000_device Sascha Hauer
  2013-12-18 15:45 ` [PATCH 2/2] net: dm9k: bail out when resources can't be claimed Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-12-18 15:45 UTC (permalink / raw)
  To: barebox

The resource sizes in the generic dm9000 register functions were
too big. This silently failed because the driver didn't check the return
values of dev_request_mem_region(). Fix both.

----------------------------------------------------------------
Sascha Hauer (2):
      net: dm9k: Fix resource sizes in add_dm9000_device
      net: dm9k: bail out when resources can't be claimed

 drivers/base/resource.c | 6 +++---
 drivers/net/dm9k.c      | 4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 1/2] net: dm9k: Fix resource sizes in add_dm9000_device
  2013-12-18 15:45 dm9000 patches Sascha Hauer
@ 2013-12-18 15:45 ` Sascha Hauer
  2013-12-18 15:45 ` [PATCH 2/2] net: dm9k: bail out when resources can't be claimed Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-12-18 15:45 UTC (permalink / raw)
  To: barebox

The dm9000 needs a resource for an index register and one for
the data register. Both should have a size of the access width,
and not two times the access width. The current code is probably
a leftover when the dm9000 had only one resource.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/base/resource.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/base/resource.c b/drivers/base/resource.c
index 2985c78..095b8d2 100644
--- a/drivers/base/resource.c
+++ b/drivers/base/resource.c
@@ -76,13 +76,13 @@ struct device_d *add_dm9000_device(int id, resource_size_t base,
 
 	switch (flags) {
 	case IORESOURCE_MEM_32BIT:
-		size = 8;
+		size = 4;
 		break;
 	case IORESOURCE_MEM_16BIT:
-		size = 4;
+		size = 2;
 		break;
 	case IORESOURCE_MEM_8BIT:
-		size = 2;
+		size = 1;
 		break;
 	default:
 		printf("dm9000: memory width flag missing\n");
-- 
1.8.5.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/2] net: dm9k: bail out when resources can't be claimed
  2013-12-18 15:45 dm9000 patches Sascha Hauer
  2013-12-18 15:45 ` [PATCH 1/2] net: dm9k: Fix resource sizes in add_dm9000_device Sascha Hauer
@ 2013-12-18 15:45 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-12-18 15:45 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/net/dm9k.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index 090482c..4c28870 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -722,7 +722,11 @@ static int dm9k_probe(struct device_d *dev)
 
 	priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
 	priv->iodata = dev_request_mem_region(dev, 1);
+	if (!priv->iodata)
+		return -EBUSY;
 	priv->iobase = dev_request_mem_region(dev, 0);
+	if (!priv->iobase)
+		return -EBUSY;
 	priv->srom = pdata->srom;
 
 	edev->init = dm9k_init_dev;
-- 
1.8.5.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2013-12-18 15:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-18 15:45 dm9000 patches Sascha Hauer
2013-12-18 15:45 ` [PATCH 1/2] net: dm9k: Fix resource sizes in add_dm9000_device Sascha Hauer
2013-12-18 15:45 ` [PATCH 2/2] net: dm9k: bail out when resources can't be claimed Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox