Commit e8668630 authored by Wolfram Sang's avatar Wolfram Sang Committed by David S. Miller

net: ethernet: renesas: ravb_main: don't open code of_device_get_match_data()

This change will also make Coverity happy by avoiding a theoretical NULL
pointer dereference; yet another reason is to use the above helper function
to tighten the code and make it more readable.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent de89e854
...@@ -1722,7 +1722,6 @@ static int ravb_set_gti(struct net_device *ndev) ...@@ -1722,7 +1722,6 @@ static int ravb_set_gti(struct net_device *ndev)
static int ravb_probe(struct platform_device *pdev) static int ravb_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
const struct of_device_id *match;
struct ravb_private *priv; struct ravb_private *priv;
enum ravb_chip_id chip_id; enum ravb_chip_id chip_id;
struct net_device *ndev; struct net_device *ndev;
...@@ -1754,8 +1753,7 @@ static int ravb_probe(struct platform_device *pdev) ...@@ -1754,8 +1753,7 @@ static int ravb_probe(struct platform_device *pdev)
ndev->base_addr = res->start; ndev->base_addr = res->start;
ndev->dma = -1; ndev->dma = -1;
match = of_match_device(of_match_ptr(ravb_match_table), &pdev->dev); chip_id = (enum ravb_chip_id)of_device_get_match_data(&pdev->dev);
chip_id = (enum ravb_chip_id)match->data;
if (chip_id == RCAR_GEN3) if (chip_id == RCAR_GEN3)
irq = platform_get_irq_byname(pdev, "ch22"); irq = platform_get_irq_byname(pdev, "ch22");
......
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