Skip to contentSkip to conversation

mmc: sdhci-pci: Remove set-but-unused variable.

PATCH In review Chris Ball 3 participants 7 messages Feb 23, 2011 – Feb 25, 2011

Subsystems (3)
lore
Share & tools
lore

Chris Ball

author
#0 lore raw

PATCH 1/3 mmc: sdhci-pci: Remove set-but-unused variable.

drivers/mmc/host/sdhci-pci.c: In function ‘sdhci_pci_probe_slot’:
drivers/mmc/host/sdhci-pci.c:913:18: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]

---
 drivers/mmc/host/sdhci-pci.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/mmc/host/sdhci-pci.c +0 -4
index 4cb2d0e..ed2cffa 100644
@@ -909,9 +909,6 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
 {
 	struct sdhci_pci_slot *slot;
 	struct sdhci_host *host;
-
-	resource_size_t addr;
-
 	int ret;
 
 	if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM)) {
@@ -958,7 +955,6 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot(
 		goto free;
 	}
 
-	addr = pci_resource_start(pdev, bar);
 	host->ioaddr = pci_ioremap_bar(pdev, bar);
 	if (!host->ioaddr) {
 		dev_err(&pdev->dev, "failed to remap registers\n");
Signature · 1 line
1.7.0.1
author
#1 lore raw

PATCH 2/3 mmc: cb710: Remove set-but-unused variable.

drivers/mmc/host/sdhci-pci.c: In function ‘sdhci_pci_probe_slot’:
drivers/mmc/host/sdhci-pci.c:913:18: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]

Cc Michał Mirosław <[email protected]>
---
 drivers/mmc/host/cb710-mmc.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/mmc/host/cb710-mmc.c +0 -2
index 66b4ce5..280c03a 100644
@@ -179,7 +179,6 @@ static int cb710_wait_for_event(struct cb710_slot *slot, u8 what)
 static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 {
 	unsigned limit = 500000;	/* FIXME: real timeout */
-	int err = 0;
 
 #ifdef CONFIG_CB710_DEBUG
 	u32 e, x;
@@ -190,7 +189,6 @@ static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 		if (!--limit) {
 			cb710_dump_regs(cb710_slot_to_chip(slot),
 				CB710_DUMP_REGS_MMC);
-			err = -ETIMEDOUT;
 			break;
 		}
 		udelay(1);
Signature · 1 line
1.7.0.1
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] mmc: cb710: Remove set-but-unused variable.

Quoted 23 lines · Chris Ball

drivers/mmc/host/sdhci-pci.c: In function ‘sdhci_pci_probe_slot’:
drivers/mmc/host/sdhci-pci.c:913:18: warning: variable ‘addr’ set but not used [-Wunused-but-set-variable]

Cc Michał Mirosław <[email protected]>
---
 drivers/mmc/host/cb710-mmc.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
drivers/mmc/host/cb710-mmc.c +0 -1
index 66b4ce5..280c03a 100644
@@ -179,7 +179,6 @@ static int cb710_wait_for_event(struct cb710_slot *slot, u8 what)
 static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 {
 	unsigned limit = 500000;	/* FIXME: real timeout */
-	int err = 0;
 
 #ifdef CONFIG_CB710_DEBUG
 	u32 e, x;

drivers/mmc/host/cb710-mmc.c static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask) · line 194

Quoted 7 lines
drivers/mmc/host/cb710-mmc.c +0 -1
@@ -190,7 +189,6 @@ static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 		if (!--limit) {
 			cb710_dump_regs(cb710_slot_to_chip(slot),
 				CB710_DUMP_REGS_MMC);
-			err = -ETIMEDOUT;
 			break;
 		}
 		udelay(1);

What about changing return 0 into return err? It gets checked in cb710_mmc_powerup().

The _other two_ patches:

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
author
#3 lore raw

PATCH v2 2/3 mmc: cb710: Return err value in cb710_wait_while_busy()

Fixes:

drivers/mmc/host/cb710-mmc.c: In function ‘cb710_wait_while_busy’:
drivers/mmc/host/cb710-mmc.c:182:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]

Cc Michał Mirosław <[email protected]>
Cc Wolfram Sang <[email protected]>

---
Hi Wolfram,

Quoted 2 lines

What about changing return 0 into return err? It gets checked in cb710_mmc_powerup().

Thanks, good idea.

- Chris.

 drivers/mmc/host/cb710-mmc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/cb710-mmc.c +1 -1
index 66b4ce5..ce2a47b 100644
@@ -205,7 +205,7 @@ static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 			"WAIT12: waited %d loops, mask %02X, entry val %08X, exit val %08X\n",
 			limit, mask, e, x);
 #endif
-	return 0;
+	return err;
 }
 
 static void cb710_mmc_set_transfer_size(struct cb710_slot *slot,
Signature · 5 lines
1.7.0.1

-- 
Chris Ball   <[email protected]>   <http://printf.net/>
One Laptop Per Child
Acked-by on v2 2/3
#4 lore raw

Re: [PATCH v2 2/3] mmc: cb710: Return err value in cb710_wait_while_busy()

Quoted 9 lines · Chris Ball

Fixes:

drivers/mmc/host/cb710-mmc.c: In function ‘cb710_wait_while_busy’:
drivers/mmc/host/cb710-mmc.c:182:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]

Cc Michał Mirosław <[email protected]>
Cc Wolfram Sang <[email protected]>
Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
maintainer Acked-by on v2 2/3
#5 lore raw

Re: [PATCH v2 2/3] mmc: cb710: Return err value in cb710_wait_while_busy()

In reply to Chris Ball
Quoted 27 lines · Chris Ball

Fixes:

drivers/mmc/host/cb710-mmc.c: In function ‘cb710_wait_while_busy’:
drivers/mmc/host/cb710-mmc.c:182:6: warning: variable ‘err’ set but not used [-Wunused-but-set-variable]

Cc Michał Mirosław <[email protected]>
Cc Wolfram Sang <[email protected]>

---
Hi Wolfram,

Quoted 2 lines

What about changing return 0 into return err? It gets checked in cb710_mmc_powerup().

Thanks, good idea.

- Chris.

 drivers/mmc/host/cb710-mmc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/cb710-mmc.c +0 -0
index 66b4ce5..ce2a47b 100644

drivers/mmc/host/cb710-mmc.c static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask) · line 211

Quoted 8 lines
drivers/mmc/host/cb710-mmc.c +1 -1
@@ -205,7 +205,7 @@ static int cb710_wait_while_busy(struct cb710_slot *slot, uint8_t mask)
 			"WAIT12: waited %d loops, mask %02X, entry val %08X, exit val %08X\n",
 			limit, mask, e, x);
 #endif
-	return 0;
+	return err;
 }
 
 static void cb710_mmc_set_transfer_size(struct cb710_slot *slot,

This patch is good. This part is not completely demystified though, and some parts of the code don't care about this function's return value.

author
#6 lore raw

PATCH 3/3 mmc: via-sdmmc: Remove set-but-unused variable.

In reply to Chris Ball

drivers/mmc/host/via-sdmmc.c: In function ‘via_reset_pcictrl’:
drivers/mmc/host/via-sdmmc.c:805:8: warning: variable ‘addrbase’ set but not used [-Wunused-but-set-variable]

---
 drivers/mmc/host/via-sdmmc.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
drivers/mmc/host/via-sdmmc.c +0 -3
index 9ed84dd..8c5b488 100644
@@ -802,12 +802,9 @@ static const struct mmc_host_ops via_sdc_ops = {
 
 static void via_reset_pcictrl(struct via_crdr_mmc_host *host)
 {
-	void __iomem *addrbase;
 	unsigned long flags;
 	u8 gatt;
 
-	addrbase = host->pcictrl_mmiobase;
-
 	spin_lock_irqsave(&host->lock, flags);
 
 	via_save_pcictrlreg(host);
Signature · 1 line
1.7.0.1