From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751932AbdHAQdV (ORCPT ); Tue, 1 Aug 2017 12:33:21 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:47201 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbdHAQdU (ORCPT ); Tue, 1 Aug 2017 12:33:20 -0400 Subject: Re: [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err To: Colin King , Marek Vasut , David Woodhouse , Brian Norris , Boris Brezillon , Richard Weinberger , linux-mtd@lists.infradead.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20170629175054.12231-1-colin.king@canonical.com> From: Cyrille Pitchen Message-ID: Date: Tue, 1 Aug 2017 18:33:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170629175054.12231-1-colin.king@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Colin, Le 29/06/2017 à 19:50, Colin King a écrit : > From: Colin Ian King > > The variable err is not updated since the previous check on it, so > the subsequent check on err is redundant and can be removed. > > Detected by CoverityScan, CID#1448658 ("Logically dead code") > > Signed-off-by: Colin Ian King > --- > drivers/mtd/spi-nor/spi-nor.c | 3 --- > 1 file changed, 3 deletions(-) > > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c > index 196b52f083ae..1296c1931591 100644 > --- a/drivers/mtd/spi-nor/spi-nor.c > +++ b/drivers/mtd/spi-nor/spi-nor.c > @@ -2307,9 +2307,6 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor, > default: > break; > } > - > - if (err) > - goto exit; Sorry but this was done on purpose to prepare the structure of the source code so it's more easy to add later parsing of optional SFDP tables such as the 4-byte address instruction set table or sector erase map table. At that time each case of the switch statement should update the value of 'err'. Best regards, Cyrille > } > > exit: >