[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 03 Mar 2016 16:39:30 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: wsa@...-dreams.de
Cc: linux-renesas-soc@...r.kernel.org,
sergei.shtylyov@...entembedded.com, netdev@...r.kernel.org
Subject: Re: [PATCH 2/2] net: ethernet: renesas: sh_eth: don't open code
of_device_get_match_data()
From: Wolfram Sang <wsa@...-dreams.de>
Date: Tue, 1 Mar 2016 17:37:59 +0100
> From: Wolfram Sang <wsa+renesas@...g-engineering.com>
>
> 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@...g-engineering.com>
> ---
>
> Tested on a Lager board.
>
> drivers/net/ethernet/renesas/sh_eth.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 0a150b2289146f..8b6c07fe3d407d 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3056,15 +3056,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);
Applied, although mdp->cd should probably be made const. It is not legal to make
modifications to the objects returned from this interface.
Powered by blists - more mailing lists