Skip to contentSkip to conversation

mmc: omap-hsmmc: Simplify bool comparison

PATCH In review Jiapeng Chong 2 participants 2 messages Feb 8, 2021 – Feb 12, 2021

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

PATCH 1/1 mmc: omap-hsmmc: Simplify bool comparison

Fix the following coccicheck warning:

./drivers/mmc/host/omap_hsmmc.c:297:6-25: WARNING: Comparison of 0/1 to bool variable.

---
 drivers/mmc/host/omap_hsmmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -4
index aa9cc49..a59e9c3 100644
@@ -285,22 +285,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on)
 		return 0;
 
 	if (power_on) {
-		if (host->pbias_enabled == 0) {
+		if (!host->pbias_enabled) {
 			ret = regulator_enable(host->pbias);
 			if (ret) {
 				dev_err(host->dev, "pbias reg enable fail\n");
 				return ret;
 			}
-			host->pbias_enabled = 1;
+			host->pbias_enabled = true;
 		}
 	} else {
-		if (host->pbias_enabled == 1) {
+		if (host->pbias_enabled) {
 			ret = regulator_disable(host->pbias);
 			if (ret) {
 				dev_err(host->dev, "pbias reg disable fail\n");
 				return ret;
 			}
-			host->pbias_enabled = 0;
+			host->pbias_enabled = false;
 		}
 	}
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Jiapeng Chong

Fix the following coccicheck warning:

./drivers/mmc/host/omap_hsmmc.c:297:6-25: WARNING: Comparison of 0/1 to bool variable.

I already have a patch for this:

https://patchwork.kernel.org/project/linux-mmc/patch/[email protected]/

Kind regards
Uffe

Quoted 38 lines
---
 drivers/mmc/host/omap_hsmmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mmc/host/omap_hsmmc.c +4 -5
index aa9cc49..a59e9c3 100644
@@ -285,22 +285,22 @@ static int omap_hsmmc_set_pbias(struct omap_hsmmc_host *host, bool power_on)
                return 0;
 
        if (power_on) {
-               if (host->pbias_enabled == 0) {
+               if (!host->pbias_enabled) {
                        ret = regulator_enable(host->pbias);
                        if (ret) {
                                dev_err(host->dev, "pbias reg enable fail\n");
                                return ret;
                        }
-                       host->pbias_enabled = 1;
+                       host->pbias_enabled = true;
                }
        } else {
-               if (host->pbias_enabled == 1) {
+               if (host->pbias_enabled) {
                        ret = regulator_disable(host->pbias);
                        if (ret) {
                                dev_err(host->dev, "pbias reg disable fail\n");
                                return ret;
                        }
-                       host->pbias_enabled = 0;
+                       host->pbias_enabled = false;
                }
        }
 
--

1.8.3.1