mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
e866863066
commit
42a67c9b0c
1 changed files with 3 additions and 7 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in a new issue