From patchwork Thu Aug 19 10:00:22 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 120329 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7JA1B21007957 for ; Thu, 19 Aug 2010 10:01:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397Ab0HSKBI (ORCPT ); Thu, 19 Aug 2010 06:01:08 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:65229 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751206Ab0HSKBH (ORCPT ); Thu, 19 Aug 2010 06:01:07 -0400 Received: by eyg5 with SMTP id 5so1065050eyg.19 for ; Thu, 19 Aug 2010 03:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=P9WCmckiQZ3XT25buftF85Fr1D2t4hvd3wnZ3V9XeVE=; b=fSO/dLy46DDWwj40mlENBUdOWJHx1PmIK6E0C27KtFg+PwqiZe4rXVh2iLo0kcVGYe YLbvBF3Th2Q15gA/9Yb7LgadUxPOInx4lZtwgZEjIUFu5IEXJHouAUMJJDb9RWEm4SPc m3BW/4EgEjtoUKHdknj5IrsjLjG9VF61dX3T4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=qxBScMpc6VAzVBktCw8jbqTwXuVNoGVVXqjcXi1SV7QXa6rao4FWt3q3oEqHHQZKcG iIPbLnr0zxL2bZT08yi/B7pFONxxPGsj/ebc+S2cpUyJ1OWqJ+MX0Ip9Q6W1dy0ADPAF WNrrbo2eLCe0gXDLjPC1B446iEOEeFv+HRxCM= Received: by 10.216.6.201 with SMTP id 51mr364079wen.110.1282212065861; Thu, 19 Aug 2010 03:01:05 -0700 (PDT) Received: from bicker ([41.205.146.22]) by mx.google.com with ESMTPS id j1sm872050wej.15.2010.08.19.03.00.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 19 Aug 2010 03:01:05 -0700 (PDT) Date: Thu, 19 Aug 2010 12:00:22 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Steven Toth , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] V4L/DVB: saa7164: move dereference under NULL check Message-ID: <20100819100022.GA6674@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 19 Aug 2010 10:01:13 +0000 (UTC) diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c index 5713f3a..ddd25d3 100644 --- a/drivers/media/video/saa7164/saa7164-buffer.c +++ b/drivers/media/video/saa7164/saa7164-buffer.c @@ -136,10 +136,11 @@ ret: int saa7164_buffer_dealloc(struct saa7164_tsport *port, struct saa7164_buffer *buf) { - struct saa7164_dev *dev = port->dev; + struct saa7164_dev *dev; - if ((buf == 0) || (port == 0)) + if (!buf || !port) return SAA_ERR_BAD_PARAMETER; + dev = port->dev; dprintk(DBGLVL_BUF, "%s() deallocating buffer @ 0x%p\n", __func__, buf);