2012-04-13 19:28:22

by Dan Carpenter

[permalink] [raw]
Subject: [patch] NFC: remove unneeded NULL check

container_of() works by subtracting the offset of the member. The math
can't really return a zero here. Sometimes people check it when they
actually meant to check something else but in this case we can just
remove the check.

Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index e6ec16d..2e11da0 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -394,9 +394,6 @@ static void pn533_wq_cmd_complete(struct work_struct *work)
struct pn533_frame *in_frame;
int rc;

- if (dev == NULL)
- return;
-
in_frame = dev->wq_in_frame;

if (dev->wq_in_error)


2012-04-16 18:13:25

by Samuel Ortiz

[permalink] [raw]
Subject: Re: [patch] NFC: remove unneeded NULL check

Hi Dan,

On Fri, Apr 13, 2012 at 10:28:12PM +0300, Dan Carpenter wrote:
> container_of() works by subtracting the offset of the member. The math
> can't really return a zero here. Sometimes people check it when they
> actually meant to check something else but in this case we can just
> remove the check.
>
> Signed-off-by: Dan Carpenter <[email protected]>
Applied to my nfc-next queue, thanks.

Cheers,
Samuel.

--
Intel Open Source Technology Centre
http://oss.intel.com/