diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2016-03-01 17:37:59 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-03 22:38:23 +0100 |
commit | 42a67c9b0c0853f6a1159bd54ed0ba50df9f9ad8 (patch) | |
tree | 1cd442700d96ebd79a413460aadc2b442b634451 /drivers/net | |
parent | net: ethernet: renesas: ravb_main: don't open code of_device_get_match_data() (diff) | |
download | linux-42a67c9b0c0853f6a1159bd54ed0ba50df9f9ad8.tar.xz linux-42a67c9b0c0853f6a1159bd54ed0ba50df9f9ad8.zip |
net: ethernet: renesas: sh_eth: 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: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/ethernet/renesas/sh_eth.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c index dfa9e59c9442..738449992876 100644 --- a/drivers/net/ethernet/renesas/sh_eth.c +++ b/drivers/net/ethernet/renesas/sh_eth.c @@ -3061,15 +3061,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) mdp->ether_link_active_low = pd->ether_link_active_low; /* set cpu data */ - if (id) { + if (id) mdp->cd = (struct sh_eth_cpu_data *)id->driver_data; - } else { - const struct of_device_id *match; + else + mdp->cd = (struct sh_eth_cpu_data *)of_device_get_match_data(&pdev->dev); - match = of_match_device(of_match_ptr(sh_eth_match_table), - &pdev->dev); - mdp->cd = (struct sh_eth_cpu_data *)match->data; - } mdp->reg_offset = sh_eth_get_register_offset(mdp->cd->register_type); if (!mdp->reg_offset) { dev_err(&pdev->dev, "Unknown register type (%d)\n", |