lkml.org 
[lkml]   [2006]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] spi: Fix modular master driver remove and device suspend/remove
Date
On Tuesday 07 February 2006 1:35 pm, Stephen Street wrote:
> On Tue, 2006-02-07 at 08:03 +0000, Russell King wrote:

> > > @@ -90,7 +90,7 @@ static int spi_suspend(struct device *de
> > > int value;
> > > struct spi_driver *drv = to_spi_driver(dev->driver);
> > >
> > > - if (!drv->suspend)
> > > + if (!drv || !drv->suspend)
> >
> > Shouldn't this be dev->driver ? If dev->driver is NULL, drv may be
> > non-NULL due to an offset in the structure.
> >
> If I understand your comment correctly, the implementation of to_spi_drv
> protects against this by returning NULL if dev->driver is NULL. This is
> implementation dependent

I'd say that to_spi_driver() is defined that way, specifically
to avoid that class of nasty bug.

> and I can make the test explicit if you want?
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-07 22:59    [W:0.295 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site