Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp814140imm; Thu, 26 Jul 2018 12:27:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfpQ9FytRkwbHM5yWgnqlf4AaXWvd3i6GXcsQKTDpHzF/jB4geG92EDI4KXLkIPxH18hEp8 X-Received: by 2002:a63:3686:: with SMTP id d128-v6mr3085768pga.18.1532633268874; Thu, 26 Jul 2018 12:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532633268; cv=none; d=google.com; s=arc-20160816; b=UQecMmuwRw4oEvFoKEMRn+qrCTkGjtO3LNwA7CvxNoOfen+gC1EXgxO12QXDNl6LNC qGQb0KEqu8HNv505JTJPP+0MT/nRaYEZQGlDSe22SsvYJAgNTYRDri6QLBVP4SwvsFI7 Tz60mF3PVK0F8ale9eAuxU1SR19LwJPEVGNQCH/SUCdAAxbhbGc7Ea8/GU/gBRR+Pd3x J8o5wqB+K9KRvfquu5FcVgPt/7Iehs0yjPdLSn2KCbhwqB7xhlybkhu4+leoQ2nyz4eF Fn5rBYJiAuEbLGlKZhoyf5fltMvnqjbdAkdFKhBJS8rEsK8yvmxVNXvXOx9pP6dBFfNB BTFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=PiZeAUHsj7tW6dYvJbze5h7e3H2oEqgoRu7sxIN5s9E=; b=PEHlutjQOH4iS/D21KUHFYnoVmoDYJAv8E343Sn58HR8ivHq6GiktFtC63iu/3WDvv bN+3avEfmThxPVYIdfTpK+ST7YxfGwf9WZmluGA3ec4ajoUjGQnwFcgTwy9aJz10YymB zJhKdfZscl0449QC5Cmt+SS2YubP5R8Iq5G8jIgFLfEh5Zye++En8vqD21XJ2jXFxMKX /9UFWx9rL85gBFAqYdqpiqVahKLbRldzAfO/7q9o43HAqbFbo1TD/OPaDH4+544JvEOz zWmovN5FzfAI+ndjLJeIGep3Jtrmh4S8HE0v/dFkQ39+KWHNXxQqCUSao7B0jKQJrl50 f4uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LIpvERgV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 64-v6si1862359ply.476.2018.07.26.12.27.34; Thu, 26 Jul 2018 12:27:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=LIpvERgV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732130AbeGZUo1 (ORCPT + 99 others); Thu, 26 Jul 2018 16:44:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60600 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730269AbeGZUo0 (ORCPT ); Thu, 26 Jul 2018 16:44:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=PiZeAUHsj7tW6dYvJbze5h7e3H2oEqgoRu7sxIN5s9E=; b=LIpvERgVmOL9ogumzFBBkSOEv 6qhJqinX1INfSfb2pfdLlVYGzYb8bwlkvLwAFUm7wVMQ1K2XtVj0RObc4J+DaudjV+fCo6sYtqcNM bcC7SmsCIhhp2lwfmtNEF+i5zHLc/l9Kzk7OYLtr8/xknhH8aaKSKZrmW/heVw4zljMdtKxuUZul+ KX0u35KpsW6FWYpz8YdChlirSxG/G6OicIczDCLBuHIS4G6Gsv/AV+DJPU70HXoCMC/k/kDBqHWFf 9Yxg48jaVvfTYkuZSBEYs8kswpXq5AuJ+X4m/c7HB3SWN18JIkUp+ONHtwj41ncUaoPv1HScPj7/I Sb3WP6I6g==; Received: from [179.95.19.99] (helo=coco.lan) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1filtq-00086H-Vk; Thu, 26 Jul 2018 19:26:11 +0000 Date: Thu, 26 Jul 2018 16:26:07 -0300 From: Mauro Carvalho Chehab To: Ivan Bornyakov Cc: mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: stv090x: fix if-else order Message-ID: <20180726162607.2de43b84@coco.lan> In-Reply-To: <20180601161221.24807-1-brnkv.i1@gmail.com> References: <20180601161221.24807-1-brnkv.i1@gmail.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Fri, 1 Jun 2018 19:12:21 +0300 Ivan Bornyakov escreveu: > There is this code: > > if (v >= 0x20) { > ... > } else if (v < 0x20) { > ... > } else if (v > 0x30) { > /* this branch is impossible */ > } > > It would be sensibly for last branch to be on the top. Have you tested it and check at the datasheets if dev_ver > 0x30 makes sense? If not, I would prefer, instead, to remove the dead code, as this patch may cause regressions (adding a FIXME comment about this special case). > > Signed-off-by: Ivan Bornyakov > --- > drivers/media/dvb-frontends/stv090x.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c > index 9133f65d4623..d70eb311ebaf 100644 > --- a/drivers/media/dvb-frontends/stv090x.c > +++ b/drivers/media/dvb-frontends/stv090x.c > @@ -4841,7 +4841,11 @@ static int stv090x_setup(struct dvb_frontend *fe) > } > > state->internal->dev_ver = stv090x_read_reg(state, STV090x_MID); > - if (state->internal->dev_ver >= 0x20) { > + if (state->internal->dev_ver > 0x30) { > + /* we shouldn't bail out from here */ > + dprintk(FE_ERROR, 1, "INFO: Cut: 0x%02x probably incomplete support!", > + state->internal->dev_ver); > + } else if (state->internal->dev_ver >= 0x20) { > if (stv090x_write_reg(state, STV090x_TSGENERAL, 0x0c) < 0) > goto err; > > @@ -4857,10 +4861,6 @@ static int stv090x_setup(struct dvb_frontend *fe) > state->internal->dev_ver); > > goto err; > - } else if (state->internal->dev_ver > 0x30) { > - /* we shouldn't bail out from here */ > - dprintk(FE_ERROR, 1, "INFO: Cut: 0x%02x probably incomplete support!", > - state->internal->dev_ver); > } > > /* ADC1 range */ Thanks, Mauro