PNP: skip dev->protocol NULL checks
authorBjorn Helgaas <bjorn.helgaas@hp.com>
Mon, 28 Apr 2008 09:15:57 +0000 (02:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:42 +0000 (08:58 -0700)
Every PNP device should have a valid protocol pointer.  If it doesn't,
something's wrong and we should oops so we can find and fix the problem.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Adrian Bunk <bunk@kernel.org>
Cc: Rene Herman <rene.herman@keyaccess.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/pnp/driver.c

index 12a1645a2e4352b3a3cc8e07941a9888dd5567cb..e85cbf116db131c5eaa78c6ffbcde234bb33c750 100644 (file)
@@ -167,7 +167,7 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
                        return error;
        }
 
-       if (pnp_dev->protocol && pnp_dev->protocol->suspend)
+       if (pnp_dev->protocol->suspend)
                pnp_dev->protocol->suspend(pnp_dev, state);
        return 0;
 }
@@ -181,7 +181,7 @@ static int pnp_bus_resume(struct device *dev)
        if (!pnp_drv)
                return 0;
 
-       if (pnp_dev->protocol && pnp_dev->protocol->resume)
+       if (pnp_dev->protocol->resume)
                pnp_dev->protocol->resume(pnp_dev);
 
        if (pnp_can_write(pnp_dev)) {