Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933940AbbBCMmc (ORCPT ); Tue, 3 Feb 2015 07:42:32 -0500 Received: from www.osadl.org ([62.245.132.105]:33529 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933917AbbBCMmb (ORCPT ); Tue, 3 Feb 2015 07:42:31 -0500 From: Nicholas Mc Guire To: Ian Abbott Cc: H Hartley Sweeten , Greg Kroah-Hartman , devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH RFC] staging: comedi: dt282x: condition with no effect - if identical to else Date: Tue, 3 Feb 2015 07:38:10 -0500 Message-Id: <1422967091-14798-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2294 Lines: 62 The if and the else branch code are identical - so the condition has no effect on the effective code - this patch removes the condition and the duplicated code. Signed-off-by: Nicholas Mc Guire --- The if and else branch are identical code thus the condition has no effect if (cmd->scan_begin_src == TRIG_FOLLOW) { /* internal trigger */ err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } else { /* external trigger */ /* should be level/edge, hi/lo specification here */ err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); } As the comments indicate that they are serving different purposes this looks like a bug. In any case - if intentional - it would need some comments on why. This needs a review by someone that knows the details of this driver. Also not sure about the retained comment string if that is still valid now. Patch was only compile tested for x86_64_defconfig + CONFIG_STAGING=y CONFIG_COMEDI=m, COMEDI_ISA_DRIVERS=y, CONFIG_COMEDI_DT282X=m Patch is against 3.0.19-rc7 (localversion = -next-20150203) drivers/staging/comedi/drivers/dt282x.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c index 051dfb2..22c59e5 100644 --- a/drivers/staging/comedi/drivers/dt282x.c +++ b/drivers/staging/comedi/drivers/dt282x.c @@ -685,14 +685,8 @@ static int dt282x_ai_cmdtest(struct comedi_device *dev, err |= cfc_check_trigger_arg_is(&cmd->start_arg, 0); - if (cmd->scan_begin_src == TRIG_FOLLOW) { - /* internal trigger */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } else { - /* external trigger */ - /* should be level/edge, hi/lo specification here */ - err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); - } + /* internal trigger */ + err |= cfc_check_trigger_arg_is(&cmd->scan_begin_arg, 0); err |= cfc_check_trigger_arg_min(&cmd->convert_arg, 4000); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/