[PATCH v8 01/14] usb: chipidea: remove unneeded NULL check

Richard Zhao richard.zhao at freescale.com
Wed Jun 27 23:37:18 EDT 2012

From: Alexander Shishkin <alexander.shishkin at linux.intel.com>

As reported by Dan Carpenter, there is a NULL check in udc_start() that
follows a dereference of the pointer that's being checked. However, at
that point udc pointer shouldn't ever be NULL and if it is, the dereference
should cause an oops.

Signed-off-by: Alexander Shishkin <alexander.shishkin at linux.intel.com>
Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Acked-by: Felipe Balbi <balbi at ti.com>
Signed-off-by: Richard Zhao <richard.zhao at freescale.com>
Acked-by: Marek Vasut <marex at denx.de>
 drivers/usb/chipidea/udc.c |    3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 51f9694..cdb9212 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1647,9 +1647,6 @@ static int udc_start(struct ci13xxx *udc)
 	struct device *dev = udc->dev;
 	int retval = 0;
-	if (!udc)
-		return -EINVAL;
 	udc->gadget.ops          = &usb_gadget_ops;

More information about the linux-arm-kernel mailing list