linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: build warning after merge of the driver-core tree
@ 2011-02-21  6:02 Stephen Rothwell
  2011-02-21  6:32 ` Greg KH
  2011-02-21 20:18 ` Ilya Yanok
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Rothwell @ 2011-02-21  6:02 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-next, linux-kernel, Marc Kleine-Budde, Ilya Yanok,
	David Miller, netdev

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

Hi Greg,

After merging the driver-core tree, today's linux-next build (x86_64
allmodconfig) produced this warning:

drivers/net/dnet.c: In function 'dnet_mii_init':
drivers/net/dnet.c:340: warning: passing argument 1 of 'platform_set_drvdata' from incompatible pointer type
include/linux/platform_device.h:138: note: expected 'struct platform_device *' but argument is of type 'struct net_device *'

Revealed by commit 71d642908d4e8e7a2a4a6e0490432e719ff466d5 ("Driver
core: convert platform_{get,set}_drvdata to static inline functions").
Introduced by commit 4796417417a62e2ae83d92cb92e1ecf9ec67b5f5 ("dnet:
Dave DNET ethernet controller driver (updated)").
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: build warning after merge of the driver-core tree
  2011-02-21  6:02 linux-next: build warning after merge of the driver-core tree Stephen Rothwell
@ 2011-02-21  6:32 ` Greg KH
  2011-02-21 20:18 ` Ilya Yanok
  1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2011-02-21  6:32 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: linux-next, linux-kernel, Marc Kleine-Budde, Ilya Yanok,
	David Miller, netdev

On Mon, Feb 21, 2011 at 05:02:26PM +1100, Stephen Rothwell wrote:
> Hi Greg,
> 
> After merging the driver-core tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> 
> drivers/net/dnet.c: In function 'dnet_mii_init':
> drivers/net/dnet.c:340: warning: passing argument 1 of 'platform_set_drvdata' from incompatible pointer type
> include/linux/platform_device.h:138: note: expected 'struct platform_device *' but argument is of type 'struct net_device *'
> 
> Revealed by commit 71d642908d4e8e7a2a4a6e0490432e719ff466d5 ("Driver
> core: convert platform_{get,set}_drvdata to static inline functions").
> Introduced by commit 4796417417a62e2ae83d92cb92e1ecf9ec67b5f5 ("dnet:
> Dave DNET ethernet controller driver (updated)").

It sounds like the driver is wrong here :(

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: linux-next: build warning after merge of the driver-core tree
  2011-02-21  6:02 linux-next: build warning after merge of the driver-core tree Stephen Rothwell
  2011-02-21  6:32 ` Greg KH
@ 2011-02-21 20:18 ` Ilya Yanok
  2011-02-21 20:20   ` [PATCH] dnet: fix wrong use of platform_set_drvdata() Ilya Yanok
  1 sibling, 1 reply; 5+ messages in thread
From: Ilya Yanok @ 2011-02-21 20:18 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Greg KH, linux-next, linux-kernel, Marc Kleine-Budde,
	David Miller, netdev

Hi Stephen, Greg,

On 21.02.2011 09:02, Stephen Rothwell wrote:
> After merging the driver-core tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
>
> drivers/net/dnet.c: In function 'dnet_mii_init':
> drivers/net/dnet.c:340: warning: passing argument 1 of 'platform_set_drvdata' from incompatible pointer type
> include/linux/platform_device.h:138: note: expected 'struct platform_device *' but argument is of type 'struct net_device *'

It's actually a bug in the driver. Thanks for reporting. I'll send the 
patch as a follow up.

Regards, Ilya.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] dnet: fix wrong use of platform_set_drvdata()
  2011-02-21 20:18 ` Ilya Yanok
@ 2011-02-21 20:20   ` Ilya Yanok
  2011-02-28 20:22     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Ilya Yanok @ 2011-02-21 20:20 UTC (permalink / raw)
  To: sfr, greg, linux-next, linux-kernel, mkl, davem, netdev; +Cc: Ilya Yanok

platform_set_drvdata() was used with argument of incorrect type and
could cause memory corruption. Moreover, because of not setting drvdata
in the correct place not all resources were freed upon module unload.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 drivers/net/dnet.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 9d8a20b..8318ea0 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -337,8 +337,6 @@ static int dnet_mii_init(struct dnet *bp)
 	for (i = 0; i < PHY_MAX_ADDR; i++)
 		bp->mii_bus->irq[i] = PHY_POLL;
 
-	platform_set_drvdata(bp->dev, bp->mii_bus);
-
 	if (mdiobus_register(bp->mii_bus)) {
 		err = -ENXIO;
 		goto err_out_free_mdio_irq;
@@ -863,6 +861,7 @@ static int __devinit dnet_probe(struct platform_device *pdev)
 	bp = netdev_priv(dev);
 	bp->dev = dev;
 
+	platform_set_drvdata(pdev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	spin_lock_init(&bp->lock);
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] dnet: fix wrong use of platform_set_drvdata()
  2011-02-21 20:20   ` [PATCH] dnet: fix wrong use of platform_set_drvdata() Ilya Yanok
@ 2011-02-28 20:22     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-02-28 20:22 UTC (permalink / raw)
  To: yanok; +Cc: sfr, greg, linux-next, linux-kernel, mkl, netdev

From: Ilya Yanok <yanok@emcraft.com>
Date: Mon, 21 Feb 2011 21:20:30 +0100

> platform_set_drvdata() was used with argument of incorrect type and
> could cause memory corruption. Moreover, because of not setting drvdata
> in the correct place not all resources were freed upon module unload.
> 
> Signed-off-by: Ilya Yanok <yanok@emcraft.com>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-28 20:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-21  6:02 linux-next: build warning after merge of the driver-core tree Stephen Rothwell
2011-02-21  6:32 ` Greg KH
2011-02-21 20:18 ` Ilya Yanok
2011-02-21 20:20   ` [PATCH] dnet: fix wrong use of platform_set_drvdata() Ilya Yanok
2011-02-28 20:22     ` David Miller

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).