From patchwork Thu Aug 19 09:50:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 4219 Return-path: Envelope-to: mchehab@pedra Delivery-date: Thu, 19 Aug 2010 07:05:20 -0300 Received: from mchehab by pedra with local (Exim 4.72) (envelope-from ) id 1Om1zs-0006SW-JU for mchehab@pedra; Thu, 19 Aug 2010 07:05:20 -0300 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 19 Aug 2010 07:05:20 -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 1Om1lV-0003Sr-KN; Thu, 19 Aug 2010 09:50:29 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752160Ab0HSJu2 (ORCPT + 1 other); Thu, 19 Aug 2010 05:50:28 -0400 Received: from mail-ww0-f44.google.com ([74.125.82.44]:42261 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133Ab0HSJu0 (ORCPT ); Thu, 19 Aug 2010 05:50:26 -0400 Received: by wwi17 with SMTP id 17so2216116wwi.1 for ; Thu, 19 Aug 2010 02:50:25 -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=NR9F62D9GwY2ImZ9O0zQDXjUEAFsF26KqEGHQpjwx7E=; b=K0Yi3gkfAw+T2GHVhAdIMMes3pFMdHJ6oWcqKteD0MCsc4w5VQ/WSi+laxCk83MX2f QkS3wzS8ntKTjwRwi6XCN4YdApyiPQKhEun46anP8DpJ0emmSQ0LyNbbGa2/GEM5oxkl TCbAv3zy6QzUdAW38wWyKU41QmV+jz5iB//zU= 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=Ggn6rraF/eJd0YkmCv0Ax8lYMYatxq9Df8kAvCLpcP9AECd+Skfty0CMw2gpOmhMP5 18UIJNpKDx8ep5gj6AVwXfkQ8bz0WZtR64c6qy/jmGp95qJVLnIAH4zTr5ixtgXZwF1O KW8X8ieoTzO4neLsLcEwd0VIufUMq0YwiO+LE= Received: by 10.227.138.6 with SMTP id y6mr8079515wbt.162.1282211425154; Thu, 19 Aug 2010 02:50:25 -0700 (PDT) Received: from bicker ([41.205.146.22]) by mx.google.com with ESMTPS id b23sm860885wbb.10.2010.08.19.02.50.16 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 19 Aug 2010 02:50:23 -0700 (PDT) Date: Thu, 19 Aug 2010 11:50:04 +0200 From: Dan Carpenter To: Mike Isely Cc: Mauro Carvalho Chehab , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] V4L/DVB: pvrusb2: remove unneeded NULL checks Message-ID: <20100819095004.GN645@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab We dereference "maskptr" unconditionally at the start of the function and also inside the call to parse_tlist() towards the end of the function. This function is called from store_val_any() and it always passes a non-NULL pointer. Signed-off-by: Dan Carpenter Acked-by: Mike Isely --- 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/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index 1b992b8..55ea914 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c +++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c @@ -513,7 +513,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, if (ret >= 0) { ret = pvr2_ctrl_range_check(cptr,*valptr); } - if (maskptr) *maskptr = ~0; + *maskptr = ~0; } else if (cptr->info->type == pvr2_ctl_bool) { ret = parse_token(ptr,len,valptr,boolNames, ARRAY_SIZE(boolNames)); @@ -522,7 +522,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, } else if (ret == 0) { *valptr = (*valptr & 1) ? !0 : 0; } - if (maskptr) *maskptr = 1; + *maskptr = 1; } else if (cptr->info->type == pvr2_ctl_enum) { ret = parse_token( ptr,len,valptr, @@ -531,7 +531,7 @@ int pvr2_ctrl_sym_to_value(struct pvr2_ctrl *cptr, if (ret >= 0) { ret = pvr2_ctrl_range_check(cptr,*valptr); } - if (maskptr) *maskptr = ~0; + *maskptr = ~0; } else if (cptr->info->type == pvr2_ctl_bitmask) { ret = parse_tlist( ptr,len,maskptr,valptr,