From patchwork Fri Jul 23 10:12:33 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3875 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Fri, 23 Jul 2010 10:12:59 +0000 Received: from bombadil.infradead.org [18.85.46.34] by localhost with IMAP (fetchmail-6.3.17) for (single-drop); Fri, 23 Jul 2010 10:37:25 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OcFFT-0005t1-Ik; Fri, 23 Jul 2010 10:12:59 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755071Ab0GWKM5 (ORCPT + 1 other); Fri, 23 Jul 2010 06:12:57 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:63916 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753563Ab0GWKM4 (ORCPT ); Fri, 23 Jul 2010 06:12:56 -0400 Received: by fxm14 with SMTP id 14so4899757fxm.19 for ; Fri, 23 Jul 2010 03:12:55 -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=pe1YBcxO3FUA6QYql+QLQHjkCo2c5PTGoSUem9lD114=; b=wBKLfUGQQIww4cEwnSFUM04vHS7rTBEqpnu9hdkFlNcFoAohI4Psdg+ZtXJTKfr7rA kC0OnCfLPwe2vowXzIYVwOupSUTtFwTfeA1FIk7yadcrssGvMz2YYSpaLQyg722Civdx 7+FT2YlO+Bwwx0lUx1cbI9zTg9WH4f0br+ouc= 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=EVGIrE+/SFgCphlw1LIzc9El+QyCA/mYxIMMTRtF+K0ixSyo9LNr4bP0QNfS1vWKQG gnVPECsZ7V9aYVKDYyG4zgYY1q0k2XNrYLOi11aKS5QssDlfyTjaVdkVXSo9RAkJNCHi 9XMsusLYDocDgGu8qju6Z11eMZgE8ba9kqGNY= Received: by 10.223.124.9 with SMTP id s9mr3030640far.91.1279879973903; Fri, 23 Jul 2010 03:12:53 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id a9sm29318faa.3.2010.07.23.03.12.43 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 23 Jul 2010 03:12:53 -0700 (PDT) Date: Fri, 23 Jul 2010 12:12:33 +0200 From: Dan Carpenter To: Andy Walls Cc: Mauro Carvalho Chehab , Ian Armstrong , ivtv-devel@ivtvdriver.org, linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch -next] V4L: ivtv: remove unneeded NULL checks Message-ID: <20100723101232.GE26313@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 In ivtvfb_callback_cleanup() we dereference "itv" before checking that it's NULL. "itv" is assigned with container_of() which basically never returns a NULL pointer so the check is pointless. I removed it, along with a similar check in ivtvfb_callback_init(). I considered adding a check for v4l2_dev, but I looked at the code and I don't think that can be NULL either. Signed-off-by: Dan Carpenter --- 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/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c index 2c2d862..be03a71 100644 --- a/drivers/media/video/ivtv/ivtvfb.c +++ b/drivers/media/video/ivtv/ivtvfb.c @@ -1239,7 +1239,7 @@ static int __init ivtvfb_callback_init(struct device *dev, void *p) struct v4l2_device *v4l2_dev = dev_get_drvdata(dev); struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev); - if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { + if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { if (ivtvfb_init_card(itv) == 0) { IVTVFB_INFO("Framebuffer registered on %s\n", itv->v4l2_dev.name); @@ -1255,7 +1255,7 @@ static int ivtvfb_callback_cleanup(struct device *dev, void *p) struct ivtv *itv = container_of(v4l2_dev, struct ivtv, v4l2_dev); struct osd_info *oi = itv->osd_info; - if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { + if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) { if (unregister_framebuffer(&itv->osd_info->ivtvfb_info)) { IVTVFB_WARN("Framebuffer %d is in use, cannot unload\n", itv->instance);