All of lore.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Cc: Colin King <colin.king@canonical.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err
Date: Tue, 01 Aug 2017 17:00:06 +0000	[thread overview]
Message-ID: <5980B396.7040802@bfs.de> (raw)
In-Reply-To: <e9fe2e63-aadf-d9cf-e7b1-dc7149677600@wedev4u.fr>



Am 01.08.2017 18:33, schrieb Cyrille Pitchen:
> Hi Colin,
> 
> Le 29/06/2017 à 19:50, Colin King a écrit :
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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 <colin.king@canonical.com>
>> ---
>>  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,
> 

This is hard to guess, could you add a comment so the next well meaning person
has a chance to know that this is onn purpose ?

re,
 wh


> Cyrille
>>  	}
>>  
>>  exit:
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>
Cc: Colin King <colin.king@canonical.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Boris Brezillon <boris.brezillon@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err
Date: Tue, 01 Aug 2017 19:00:06 +0200	[thread overview]
Message-ID: <5980B396.7040802@bfs.de> (raw)
In-Reply-To: <e9fe2e63-aadf-d9cf-e7b1-dc7149677600@wedev4u.fr>



Am 01.08.2017 18:33, schrieb Cyrille Pitchen:
> Hi Colin,
> 
> Le 29/06/2017 à 19:50, Colin King a écrit :
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> 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 <colin.king@canonical.com>
>> ---
>>  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,
> 

This is hard to guess, could you add a comment so the next well meaning person
has a chance to know that this is onn purpose ?

re,
 wh


> Cyrille
>>  	}
>>  
>>  exit:
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-08-01 17:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 17:50 [PATCH][mtd-next] mtd: spi-nor: remove redundant check on err Colin King
2017-06-29 17:50 ` Colin King
2017-08-01 16:33 ` Cyrille Pitchen
2017-08-01 16:33   ` Cyrille Pitchen
2017-08-01 17:00   ` walter harms [this message]
2017-08-01 17:00     ` walter harms

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5980B396.7040802@bfs.de \
    --to=wharms@bfs.de \
    --cc=boris.brezillon@free-electrons.com \
    --cc=colin.king@canonical.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.