* [PATCH] sdhci: remove redundant check of zero slots
@ 2017-08-18 12:37 Colin King
2017-08-18 13:15 ` Adrian Hunter
0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2017-08-18 12:37 UTC (permalink / raw)
To: Adrian Hunter, Ulf Hansson, linux-mmc; +Cc: kernel-janitors, linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] sdhci: remove redundant check of zero slots
2017-08-18 12:37 [PATCH] sdhci: remove redundant check of zero slots Colin King
@ 2017-08-18 13:15 ` Adrian Hunter
0 siblings, 0 replies; 2+ messages in thread
From: Adrian Hunter @ 2017-08-18 13:15 UTC (permalink / raw)
To: Colin King, Ulf Hansson, linux-mmc; +Cc: kernel-janitors, linux-kernel
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.
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-08-18 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18 12:37 [PATCH] sdhci: remove redundant check of zero slots Colin King
2017-08-18 13:15 ` Adrian Hunter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox