netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Simon Horman <horms@verge.net.au>
Cc: linux-renesas-soc@vger.kernel.org,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] net: ethernet: renesas: sh_eth: don't open code of_device_get_match_data()
Date: Wed, 2 Mar 2016 07:46:24 +0100	[thread overview]
Message-ID: <20160302064623.GA1403@katana> (raw)
In-Reply-To: <20160302012134.GB32543@verge.net.au>

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

On Wed, Mar 02, 2016 at 10:21:34AM +0900, Simon Horman wrote:
> On Tue, Mar 01, 2016 at 05:37:59PM +0100, Wolfram Sang wrote:
> > From: Wolfram Sang <wsa+renesas@sang-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@sang-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);
> 
> Is the cast needed here? of_device_get_match_data returns void *

The compiler complains about a const mismatch without the cast. To keep
things simple, I decided to leave the cast.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-03-02  6:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-01 16:37 [PATCH 1/2] net: ethernet: renesas: ravb_main: don't open code of_device_get_match_data() Wolfram Sang
2016-03-01 16:37 ` [PATCH 2/2] net: ethernet: renesas: sh_eth: " Wolfram Sang
2016-03-02  1:21   ` Simon Horman
2016-03-02  6:46     ` Wolfram Sang [this message]
2016-03-03  0:04       ` Simon Horman
2016-03-03 21:39   ` David Miller
2016-03-02  1:19 ` [PATCH 1/2] net: ethernet: renesas: ravb_main: " Simon Horman
2016-03-02  9:11 ` Geert Uytterhoeven
2016-03-03 21:39 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160302064623.GA1403@katana \
    --to=wsa@the-dreams.de \
    --cc=horms@verge.net.au \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).