Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1714883 > unrolled thread

[PATCH] sdhci: remove redundant check of zero slots

Started byColin King <colin.king@canonical.com>
First post2017-08-18 14:40 +0200
Last post2017-08-18 15:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sdhci: remove redundant check of zero slots Colin King <colin.king@canonical.com> - 2017-08-18 14:40 +0200
    Re: [PATCH] sdhci: remove redundant check of zero slots Adrian Hunter <adrian.hunter@intel.com> - 2017-08-18 15:30 +0200

#1714883 — [PATCH] sdhci: remove redundant check of zero slots

FromColin King <colin.king@canonical.com>
Date2017-08-18 14:40 +0200
Subject[PATCH] sdhci: remove redundant check of zero slots
Message-ID<ufOJc-3Ie-9@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Slots can never be zero, PCI_SLOTS_INFO_SLOTS returns a value in the
range 0..7; slots is one more than this, 1..8 so cannot be zero and
so the zero check is redundant and can be removed.

Detected by CoverityScan, CID#744269 ("Logically Dead Code")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/mmc/host/sdhci-pci-core.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
index 2c853cfa8389..43b2b09131bd 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -1669,8 +1669,6 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
 
 	slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
 	dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
-	if (slots == 0)
-		return -ENODEV;
 
 	BUG_ON(slots > MAX_SLOTS);
 
-- 
2.11.0

[toc] | [next] | [standalone]


#1714951

FromAdrian Hunter <adrian.hunter@intel.com>
Date2017-08-18 15:30 +0200
Message-ID<ufPvA-4h9-19@gated-at.bofh.it>
In reply to#1714883
On 18/08/17 15:37, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Slots can never be zero, PCI_SLOTS_INFO_SLOTS returns a value in the
> range 0..7; slots is one more than this, 1..8 so cannot be zero and
> so the zero check is redundant and can be removed.
> 
> Detected by CoverityScan, CID#744269 ("Logically Dead Code")
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/mmc/host/sdhci-pci-core.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
> index 2c853cfa8389..43b2b09131bd 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -1669,8 +1669,6 @@ static int sdhci_pci_probe(struct pci_dev *pdev,
>  
>  	slots = PCI_SLOT_INFO_SLOTS(slots) + 1;
>  	dev_dbg(&pdev->dev, "found %d slot(s)\n", slots);
> -	if (slots == 0)
> -		return -ENODEV;
>  
>  	BUG_ON(slots > MAX_SLOTS);

Isn't MAX_SLOTS == 8? So that is dead too.

>  
> 

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web