summaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/patches-4.4/0514-net-mediatek-fix_esw.patch
blob: de44a9f2867a9769277dc87084f2f2dbe9c15e2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--- a/drivers/net/ethernet/mediatek/esw_rt3050.c
+++ b/drivers/net/ethernet/mediatek/esw_rt3050.c
@@ -16,6 +16,7 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <asm/mach-ralink/ralink_regs.h>
+#include <linux/of_irq.h>
 
 #include <linux/switch.h>
 
@@ -1332,7 +1333,6 @@ static int esw_probe(struct platform_dev
 	const __be32 *port_map, *reg_init;
 	struct switch_dev *swdev;
 	struct rt305x_esw *esw;
-	struct resource *irq;
 	int ret;
 
 	esw = devm_kzalloc(&pdev->dev, sizeof(*esw), GFP_KERNEL);
@@ -1340,7 +1340,7 @@ static int esw_probe(struct platform_dev
 		return -ENOMEM;
 
 	esw->dev = &pdev->dev;
-	esw->irq = irq->start;
+	esw->irq = irq_of_parse_and_map(np, 0);
 	esw->base = devm_ioremap_resource(&pdev->dev, res);
 	if (!esw->base)
 		return -EADDRNOTAVAIL;
@@ -1365,7 +1365,7 @@ static int esw_probe(struct platform_dev
 	ret = register_switch(swdev, NULL);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "register_switch failed\n");
-		goto unmap_base;
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, esw);
@@ -1383,11 +1383,6 @@ static int esw_probe(struct platform_dev
 	}
 
 	return ret;
-
-unmap_base:
-	iounmap(esw->base);
-	kfree(esw);
-	return ret;
 }
 
 static int esw_remove(struct platform_device *pdev)