From patchwork Sat Feb 6 08:43:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julia Lawall X-Patchwork-Id: 2629 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Sat, 06 Feb 2010 08:44:21 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for (single-drop); Sat, 06 Feb 2010 23:31:26 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1NdgH7-0002V3-8I; Sat, 06 Feb 2010 08:44:21 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754464Ab0BFIoE (ORCPT + 1 other); Sat, 6 Feb 2010 03:44:04 -0500 Received: from mgw1.diku.dk ([130.225.96.91]:52518 "EHLO mgw1.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753941Ab0BFIoA (ORCPT ); Sat, 6 Feb 2010 03:44:00 -0500 Received: from localhost (localhost [127.0.0.1]) by mgw1.diku.dk (Postfix) with ESMTP id C5C1252C3A8; Sat, 6 Feb 2010 09:43:59 +0100 (CET) X-Virus-Scanned: amavisd-new at diku.dk Received: from mgw1.diku.dk ([127.0.0.1]) by localhost (mgw1.diku.dk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hc3N+kuiVUOz; Sat, 6 Feb 2010 09:43:58 +0100 (CET) Received: from nhugin.diku.dk (nhugin.diku.dk [130.225.96.140]) by mgw1.diku.dk (Postfix) with ESMTP id 8DAC952C384; Sat, 6 Feb 2010 09:43:58 +0100 (CET) Received: from ask.diku.dk (ask.diku.dk [130.225.96.225]) by nhugin.diku.dk (Postfix) with ESMTP id B8B066DF8AC; Sat, 6 Feb 2010 09:38:55 +0100 (CET) Received: by ask.diku.dk (Postfix, from userid 3767) id 57A36200AA; Sat, 6 Feb 2010 09:43:58 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by ask.diku.dk (Postfix) with ESMTP id 4F1D7200A9; Sat, 6 Feb 2010 09:43:58 +0100 (CET) Date: Sat, 6 Feb 2010 09:43:58 +0100 (CET) From: Julia Lawall To: Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 7/11] drivers/media: Correct NULL test Message-ID: MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Julia Lawall In each case, the NULL test has been performed already. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // @r@ expression *x; expression e; identifier l; @@ if (x == NULL || ...) { ... when forall return ...; } ... when != goto l; when != x = e when != &x *x == NULL // Signed-off-by: Julia Lawall --- drivers/media/dvb/frontends/stv0900_core.c | 5 ----- drivers/media/video/cpia.c | 3 --- 2 files changed, 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/dvb/frontends/stv0900_core.c b/drivers/media/dvb/frontends/stv0900_core.c index 74791d5..9052a9b 100644 --- a/drivers/media/dvb/frontends/stv0900_core.c +++ b/drivers/media/dvb/frontends/stv0900_core.c @@ -1410,11 +1410,6 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe, return error; } - if (state->internal == NULL) { - error = STV0900_INVALID_HANDLE; - return error; - } - intp = state->internal; intp->demod_mode = p_init->demod_mode; diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 551ddf2..933ae4c 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c @@ -3737,9 +3737,6 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) return -EINVAL; - if (!cam || !cam->ops) - return -ENODEV; - /* make this _really_ smp-safe */ if (mutex_lock_interruptible(&cam->busy_lock)) return -EINTR;