Re: pnp_bus_resume(): inconsequent NULL checking

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Bjorn Helgaas
Date: Wednesday, February 20, 2008 - 9:59 am

On Tuesday 19 February 2008 05:00:43 pm Rene Herman wrote:

I agree with you that we can just delete the dev->protocol tests
completely. So I'd rather see something like this (built but untested):


PNP: remove dev->protocol NULL checks

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>

Index: work6/drivers/pnp/driver.c
===================================================================
--- work6.orig/drivers/pnp/driver.c	2008-02-20 09:46:01.000000000 -0700
+++ work6/drivers/pnp/driver.c	2008-02-20 09:46:28.000000000 -0700
@@ -167,7 +167,7 @@
 			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 @@
 	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)) {
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
pnp_bus_resume(): inconsequent NULL checking, Adrian Bunk, (Tue Feb 19, 3:49 pm)
Re: pnp_bus_resume(): inconsequent NULL checking, Rene Herman, (Tue Feb 19, 5:00 pm)
Re: pnp_bus_resume(): inconsequent NULL checking, Bjorn Helgaas, (Wed Feb 20, 9:59 am)
Re: pnp_bus_resume(): inconsequent NULL checking, Rene Herman, (Wed Feb 20, 10:47 pm)
Re: pnp_bus_resume(): inconsequent NULL checking, Bjorn Helgaas, (Thu Feb 21, 8:26 am)
Re: pnp_bus_resume(): inconsequent NULL checking, Adrian Bunk, (Thu Feb 21, 9:09 am)
Re: pnp_bus_resume(): inconsequent NULL checking, Rene Herman, (Thu Feb 21, 9:18 am)