netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: florian@openwrt.org
Cc: jeff@garzik.org, netdev@vger.kernel.org, n0-1@freewrt.org
Subject: Re: [PATCH] korina: fix probing crash
Date: Mon, 12 Jan 2009 21:52:02 -0800 (PST)	[thread overview]
Message-ID: <20090112.215202.194850308.davem@davemloft.net> (raw)
In-Reply-To: <200901111654.24651.florian@openwrt.org>

From: Florian Fainelli <florian@openwrt.org>
Date: Sun, 11 Jan 2009 16:54:24 +0100

> korina: fix probing crash
> 
> This patch fixes the wrong retrieval of platform_data
> which makes the driver crash on probe. Propagate error
> if the platform_driver cannot use its data.
> 
> Signed-off-by: Florian Fainelli <florian@openwrt.org>

There are several problems with this patch:

> @@ -1078,12 +1078,18 @@ static int korina_close(struct net_device *dev)
>  
>  static int korina_probe(struct platform_device *pdev)
>  {
> -	struct korina_device *bif = platform_get_drvdata(pdev);
> +	struct korina_device *bif;
>  	struct korina_private *lp;
>  	struct net_device *dev;
>  	struct resource *r;
>  	int rc;
>  
> +	bif = (struct korina_device *)pdev->dev.platform_data;

This cast is unnecessary, platform_data is "void *"

Secondly, korina_remove() also expects the korina_device pointer to be
in the platform drvdata.  It therefore has the same bug as
korina_probe() and needs to be fixed too.

But I suspect there is some other weird problem here.  If
you need to change from drvdata over to platform_data, then
this driver never could have been probed or removed properly.

This is absolutely a fundamental bug, where did it come from?

  reply	other threads:[~2009-01-13  5:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-11 15:54 [PATCH] korina: fix probing crash Florian Fainelli
2009-01-13  5:52 ` David Miller [this message]
     [not found]   ` <1231955241-6440-1-git-send-email-n0-1@freewrt.org>
2009-01-15  5:47     ` [PATCH] korina: fix usage of driver_data 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=20090112.215202.194850308.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=florian@openwrt.org \
    --cc=jeff@garzik.org \
    --cc=n0-1@freewrt.org \
    --cc=netdev@vger.kernel.org \
    /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).