Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753716AbdLMUYa (ORCPT ); Wed, 13 Dec 2017 15:24:30 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:46331 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752932AbdLMUY2 (ORCPT ); Wed, 13 Dec 2017 15:24:28 -0500 Date: Wed, 13 Dec 2017 21:24:25 +0100 From: Boris Brezillon To: Colin King Cc: Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][mtd-next] mtd: nand: remove redundant check of len Message-ID: <20171213212425.6fe999cb@bbrezillon> In-Reply-To: <20171213201743.27324-1-colin.king@canonical.com> References: <20171213201743.27324-1-colin.king@canonical.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1197 Lines: 43 On Wed, 13 Dec 2017 20:17:43 +0000 Colin King wrote: > From: Colin Ian King > > The check of len being zero is redundant as it has already been > sanity checked for this value at the start of the function. Hence > it is impossible for this test to be true and so the redundant > code can be removed. Nope, it's not the same test, the initial test is if (len && !buf) not if (len) So this test is not redundant. > > Detected by CoverityScan, CID#1462748 ("Logically dead code") > > Signed-off-by: Colin Ian King > --- > drivers/mtd/nand/nand_base.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c > index afd5e18db81c..9daaa23db943 100644 > --- a/drivers/mtd/nand/nand_base.c > +++ b/drivers/mtd/nand/nand_base.c > @@ -1507,10 +1507,6 @@ static int nand_read_param_page_op(struct nand_chip *chip, u8 page, void *buf, > }; > struct nand_operation op = NAND_OPERATION(instrs); > > - /* Drop the DATA_IN instruction if len is set to 0. */ > - if (!len) > - op.ninstrs--; > - > return nand_exec_op(chip, &op); > } >