public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0
@ 2019-05-31 11:32 Colin King
  2019-05-31 11:35 ` Adrian Hunter
  2019-06-03 13:48 ` Ulf Hansson
  0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2019-05-31 11:32 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson, linux-mmc; +Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The calculation of slots results in a value in the range 1..8
and so slots can never be zero.  The check for slots = 0 is
always going to be false, hence it is redundant and can be
removed.

Addresses-Coverity: ("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 ab9e2b901094..f70436261746 100644
--- a/drivers/mmc/host/sdhci-pci-core.c
+++ b/drivers/mmc/host/sdhci-pci-core.c
@@ -2044,8 +2044,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.20.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0
  2019-05-31 11:32 [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0 Colin King
@ 2019-05-31 11:35 ` Adrian Hunter
  2019-06-03 13:48 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Adrian Hunter @ 2019-05-31 11:35 UTC (permalink / raw)
  To: Colin King, Ulf Hansson, linux-mmc; +Cc: kernel-janitors, linux-kernel

On 31/05/19 2:32 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The calculation of slots results in a value in the range 1..8
> and so slots can never be zero.  The check for slots = 0 is
> always going to be false, hence it is redundant and can be
> removed.
> 
> Addresses-Coverity: ("Logically dead code")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.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 ab9e2b901094..f70436261746 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -2044,8 +2044,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);
>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0
  2019-05-31 11:32 [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0 Colin King
  2019-05-31 11:35 ` Adrian Hunter
@ 2019-06-03 13:48 ` Ulf Hansson
  1 sibling, 0 replies; 3+ messages in thread
From: Ulf Hansson @ 2019-06-03 13:48 UTC (permalink / raw)
  To: Colin King
  Cc: Adrian Hunter, linux-mmc@vger.kernel.org, kernel-janitors,
	Linux Kernel Mailing List

On Fri, 31 May 2019 at 13:32, Colin King <colin.king@canonical.com> wrote:
>
> From: Colin Ian King <colin.king@canonical.com>
>
> The calculation of slots results in a value in the range 1..8
> and so slots can never be zero.  The check for slots = 0 is
> always going to be false, hence it is redundant and can be
> removed.
>
> Addresses-Coverity: ("Logically dead code")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  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 ab9e2b901094..f70436261746 100644
> --- a/drivers/mmc/host/sdhci-pci-core.c
> +++ b/drivers/mmc/host/sdhci-pci-core.c
> @@ -2044,8 +2044,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.20.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-03 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-31 11:32 [PATCH] mmc: sdhci-pci: remove redundant check of slots == 0 Colin King
2019-05-31 11:35 ` Adrian Hunter
2019-06-03 13:48 ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox