Skip to contentSkip to conversation

mmc: sdhci-bcm-kona: '|' vs '&' typo

PATCH In review Dan Carpenter 3 participants 4 messages Aug 21, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mmc: sdhci-bcm-kona: '|' vs '&' typo

The intent was to test if a flag was set. In the current code the conditions are always true.

---
Static checker stuff. Untested.

drivers/mmc/host/sdhci-bcm-kona.c +2 -2
index 87175f9..9ffac0b 100644
@@ -263,7 +263,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 		(mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N',
 		(mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N');
 
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE)
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
 		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
 	dev_dbg(dev, "is_8bit=%c\n",
@@ -282,7 +282,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 	}
 
 	/* if device is eMMC, emulate card insert right here */
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE) {
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE) {
 		ret = sdhci_bcm_kona_sd_card_emulate(host, 1);
 		if (ret) {
 			dev_err(dev,
#1 lore raw

Am 21.08.2013 10:24, schrieb Dan Carpenter:

Quoted 2 lines

The intent was to test if a flag was set. In the current code the conditions are always true.

I guess that it worked before ...
That leaves the Question: are the tests needed at all ?

re,
wh

Quoted 31 lines

---
Static checker stuff. Untested.

drivers/mmc/host/sdhci-bcm-kona.c +2 -3
index 87175f9..9ffac0b 100644
@@ -263,7 +263,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 		(mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N',
 		(mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N');
 
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE)
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
 		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
 	dev_dbg(dev, "is_8bit=%c\n",
@@ -282,7 +282,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 	}
 
 	/* if device is eMMC, emulate card insert right here */
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE) {
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE) {
 		ret = sdhci_bcm_kona_sd_card_emulate(host, 1);
 		if (ret) {
 			dev_err(dev,
--

To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 8 lines · walter harms

Am 21.08.2013 10:24, schrieb Dan Carpenter:

Quoted 2 lines

The intent was to test if a flag was set. In the current code the conditions are always true.

I guess that it worked before ...
That leaves the Question: are the tests needed at all ?

It's flagging everything as broken, and I presume that isn't good. But on the other hand, these changes do occasionally break things because now a lot of new untested code is used. It really is a good idea for someone to test this.

Quoted 3 lines
Quoted 3 lines

---
Static checker stuff. Untested.

regards,
dan carpenter

#3 lore raw
In reply to Dan Carpenter

Hi Dan,
Good catch. This fix is already in the "ARM: mmc: fix NONREMOVABLE test in sdhci-bcm-kona" patch that is part of the git pull request sent to armsoc yesterday:
http://lists.infradead.org/pipermail/linux-arm-kernel/2013-August/193422.html

Thanks,
Csd

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Wednesday, August 21, 2013 1:24 AM
To: Chris Ball
Cc: Grant Likely; Rob Herring; Christian Daudt; Arnd Bergmann; [email protected]; [email protected]; [email protected]
Subject: [patch] mmc: sdhci-bcm-kona: '|' vs '&' typo

The intent was to test if a flag was set. In the current code the conditions are always true.

---
Static checker stuff. Untested.

drivers/mmc/host/sdhci-bcm-kona.c +2 -2
index 87175f9..9ffac0b 100644
@@ -263,7 +263,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 		(mmc_gpio_get_cd(host->mmc) != -ENOSYS) ? 'Y' : 'N',
 		(mmc_gpio_get_ro(host->mmc) != -ENOSYS) ? 'Y' : 'N');
 
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE)
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE)
 		host->quirks |= SDHCI_QUIRK_BROKEN_CARD_DETECTION;
 
 	dev_dbg(dev, "is_8bit=%c\n",
@@ -282,7 +282,7 @@ static int __init sdhci_bcm_kona_probe(struct platform_device *pdev)
 	}
 
 	/* if device is eMMC, emulate card insert right here */
-	if (host->mmc->caps | MMC_CAP_NONREMOVABLE) {
+	if (host->mmc->caps & MMC_CAP_NONREMOVABLE) {
 		ret = sdhci_bcm_kona_sd_card_emulate(host, 1);
 		if (ret) {
 			dev_err(dev,