From patchwork Wed Apr 10 11:40:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 2420751 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 17194DF2E5 for ; Wed, 10 Apr 2013 11:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757706Ab3DJLm4 (ORCPT ); Wed, 10 Apr 2013 07:42:56 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:45641 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496Ab3DJLmz (ORCPT ); Wed, 10 Apr 2013 07:42:55 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3ABgoGe015938 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 10 Apr 2013 11:42:51 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3ABgncE007627 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 10 Apr 2013 11:42:50 GMT Received: from abhmt104.oracle.com (abhmt104.oracle.com [141.146.116.56]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3ABgnCR007607; Wed, 10 Apr 2013 11:42:49 GMT Received: from longonot.mountain (/197.237.137.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 10 Apr 2013 04:42:48 -0700 Date: Wed, 10 Apr 2013 14:40:51 +0300 From: Dan Carpenter To: Mauro Carvalho Chehab , Andrey Smirnov Cc: Hans Verkuil , linux-media@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] [media] radio-si476x: check different function pointers Message-ID: <20130410114051.GA21419@longonot.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This is a static checker where it complains if we check for one function pointer and then call a different function on the next line. In most cases, the code does the same thing before and after this patch. For example, when ->phase_diversity is non-NULL then ->phase_div_status is also non-NULL. The one place where that's not true is when we check ->rds_blckcnt instead of ->rsq_status. In those cases, we would want to call ->rsq_status but we instead return -ENOENT. Signed-off-by: Dan Carpenter --- Please review this carefully. I don't have the hardware to test it. -- 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/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c index 9430c6a..817fc0c 100644 --- a/drivers/media/radio/radio-si476x.c +++ b/drivers/media/radio/radio-si476x.c @@ -854,7 +854,7 @@ static int si476x_radio_g_volatile_ctrl(struct v4l2_ctrl *ctrl) switch (ctrl->id) { case V4L2_CID_SI476X_INTERCHIP_LINK: if (si476x_core_has_diversity(radio->core)) { - if (radio->ops->phase_diversity) { + if (radio->ops->phase_div_status) { retval = radio->ops->phase_div_status(radio->core); if (retval < 0) break; @@ -1285,7 +1285,7 @@ static ssize_t si476x_radio_read_agc_blob(struct file *file, struct si476x_agc_status_report report; si476x_core_lock(radio->core); - if (radio->ops->rds_blckcnt) + if (radio->ops->agc_status) err = radio->ops->agc_status(radio->core, &report); else err = -ENOENT; @@ -1320,7 +1320,7 @@ static ssize_t si476x_radio_read_rsq_blob(struct file *file, }; si476x_core_lock(radio->core); - if (radio->ops->rds_blckcnt) + if (radio->ops->rsq_status) err = radio->ops->rsq_status(radio->core, &args, &report); else err = -ENOENT; @@ -1355,7 +1355,7 @@ static ssize_t si476x_radio_read_rsq_primary_blob(struct file *file, }; si476x_core_lock(radio->core); - if (radio->ops->rds_blckcnt) + if (radio->ops->rsq_status) err = radio->ops->rsq_status(radio->core, &args, &report); else err = -ENOENT;