From patchwork Sat Oct 8 12:03:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 37381 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsrSc-00066o-45; Sat, 08 Oct 2016 13:14:42 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-7) with esmtp id 1bsrSa-0005Pn-0E; Sat, 08 Oct 2016 15:14:42 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752410AbcJHNOc (ORCPT + 1 other); Sat, 8 Oct 2016 09:14:32 -0400 Received: from www.osadl.org ([62.245.132.105]:57298 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752217AbcJHNOb (ORCPT ); Sat, 8 Oct 2016 09:14:31 -0400 X-Greylist: delayed 3579 seconds by postgrey-1.27 at vger.kernel.org; Sat, 08 Oct 2016 09:14:30 EDT Received: from debian01.hofrr.at (mail.osadl.at [92.243.35.153]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id u98C1XpW022168; Sat, 8 Oct 2016 14:01:33 +0200 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Cc: Alejandro Torrado , Nicolas Sugino , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] [media] dib0700: remove redundant else Date: Sat, 8 Oct 2016 14:03:19 +0200 Message-Id: <1475928199-20315-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-1.9 required=6.0 tests=BAYES_00, KHOP_SC_TOP_CIDR8 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.10.8.130617 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, FROM_NAME_PHRASE 0, LEGITIMATE_NEGATE 0, LEGITIMATE_SIGNS 0, MULTIPLE_REAL_RCPTS 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CC_NAME 0, __CC_NAME_DIFF_FROM_ACC 0, __CC_REAL_NAMES 0, __CP_URI_IN_BODY 0, __FROM_DOMAIN_IN_ANY_CC2 0, __FROM_DOMAIN_IN_RCPT 0, __HAS_CC_HDR 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NAME 0, __TO_NAME_DIFF_FROM_ACC 0, __TO_REAL_NAMES 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0' The if and else are identical and can be consolidated here. Fixes: commit 91be260faaf8 ("[media] dib8000: Add support for Mygica/Geniatech S2870") Signed-off-by: Nicholas Mc Guire --- Problem found by coccinelle script Based only on reviewing this driver it seems that the dib0090_config is not an array and thus this is a cut&past bug - but not having access to the driver I can not say. Other cases that have the conditioning on (adap->id == 0) e.g. dib7070p_dib0070 actually have a config array (dib7070p_dib0070_config[]). So the if/else here most likely is unnecessary. The patch is actually a partial revert of commit 91be260faaf8 ("[media] dib8000: Add support for Mygica/Geniatech S2870") where this if/else was deliberately introduced but without any specific comments. This needs a review by someone that has access to the details of the driver. Patch was compile tested with: x86_64_defconfig + CONFIG_MEDIA_SUPPORT=m, CONFIG_MEDIA_USB_SUPPORT=y, CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y, CONFIG_DVB_USB=m, CONFIG_DVB_USB_V2=m, CONFIG_MEDIA_RC_SUPPORT=y, CONFIG_DVB_USB_DIB0700=m Patch is against 4.8.0 (localversion-next is -next-20161006) drivers/media/usb/dvb-usb/dib0700_devices.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c index 0857b56..3cd8566 100644 --- a/drivers/media/usb/dvb-usb/dib0700_devices.c +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c @@ -1736,13 +1736,9 @@ static int dib809x_tuner_attach(struct dvb_usb_adapter *adap) struct dib0700_adapter_state *st = adap->priv; struct i2c_adapter *tun_i2c = st->dib8000_ops.get_i2c_master(adap->fe_adap[0].fe, DIBX000_I2C_INTERFACE_TUNER, 1); - if (adap->id == 0) { - if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) - return -ENODEV; - } else { - if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, tun_i2c, &dib809x_dib0090_config) == NULL) - return -ENODEV; - } + if (dvb_attach(dib0090_register, adap->fe_adap[0].fe, + tun_i2c, &dib809x_dib0090_config) == NULL) + return -ENODEV; st->set_param_save = adap->fe_adap[0].fe->ops.tuner_ops.set_params; adap->fe_adap[0].fe->ops.tuner_ops.set_params = dib8096_set_param_override;