From patchwork Mon May 31 19:27:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 3569 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Mon, 31 May 2010 19:28:01 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Mon, 31 May 2010 16:30:38 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1OJAeX-0003Yh-5b; Mon, 31 May 2010 19:28:01 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756201Ab0EaT16 (ORCPT + 1 other); Mon, 31 May 2010 15:27:58 -0400 Received: from mail-ew0-f216.google.com ([209.85.219.216]:46547 "EHLO mail-ew0-f216.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753036Ab0EaT14 (ORCPT ); Mon, 31 May 2010 15:27:56 -0400 Received: by ewy8 with SMTP id 8so1046773ewy.28 for ; Mon, 31 May 2010 12:27: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=C95+NrTOpU66Yt9kBhxdff6/8oEpEsEBjrz0cmxefLA=; b=vIhMLgIb40zrT/543vL3rSet6DZAslsXvrhhDZAiQjrq3ghEjx5SxojfPr2QpAMTlB Mv/Z8Qj4U1e8BMjInlAPir0Bz92p+yEocYkvqjsSp4uOi7eRTFhXQL/KnPHNdfse0Yo9 o/RAq2WNf6JHJnoFgsqW2JvGe0IbSgA4M50J8= 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=A47W6S6zhhCQ45vWo7txhyiuX2uy4tp7ndJQCYi4QGCBd3YUSQlJy4OZWZK6uRmKis ynZb3MYtB0Z2J2n6AoAjv19L95skyhnU6CMAlV/h0BW+oMTkvYMtqDv0uc4Ltu5mbhs1 kpbxa74DdaoVJH45HdZJ3551NlSmBMFECe86w= Received: by 10.213.15.206 with SMTP id l14mr5228254eba.47.1275334075002; Mon, 31 May 2010 12:27:55 -0700 (PDT) Received: from bicker ([205.177.176.130]) by mx.google.com with ESMTPS id 13sm3242055ewy.1.2010.05.31.12.27.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 31 May 2010 12:27:54 -0700 (PDT) Date: Mon, 31 May 2010 21:27:39 +0200 From: Dan Carpenter To: Mauro Carvalho Chehab Cc: Antti Palosaari , =?iso-8859-1?Q?Andr=E9?= Goddard Rosa , Jiri Kosina , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] V4L/DVB: remove unneeded null check in anysee_probe() Message-ID: <20100531192632.GZ5483@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 Smatch complained because "d" is dereferenced first and then checked for null later . The only code path where "d" could be a invalid pointer is if this is a cold device in dvb_usb_device_init(). I consulted Antti Palosaari and he explained that anysee is always a warm device. I have added a comment and removed the unneeded null check. 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/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index faca1ad..aa5c7d5 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c @@ -463,6 +463,11 @@ static int anysee_probe(struct usb_interface *intf, if (intf->num_altsetting < 1) return -ENODEV; + /* + * Anysee is always warm (its USB-bridge, Cypress FX2, uploads + * firmware from eeprom). If dvb_usb_device_init() succeeds that + * means d is a valid pointer. + */ ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d, adapter_nr); if (ret) @@ -479,10 +484,7 @@ static int anysee_probe(struct usb_interface *intf, if (ret) return ret; - if (d) - ret = anysee_init(d); - - return ret; + return anysee_init(d); } static struct usb_device_id anysee_table[] = {