[alsa-devel] [PATCH 2/3] asoc: (cosmetic) simplify a condition

Guennadi Liakhovetski guennadi.liakhovetski at intel.com
Wed Jan 30 17:22:40 CET 2019


From: Guennadi Liakhovetski <guennadi.liakhovetski at linux.intel.com>

Double negation is often used in the kernel to avoid explicit comparison
to 0. However an "if (!!a == !!b)" test can be trivially reduced to "if
(!a == !b)".

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski at linux.intel.com>
---
 sound/soc/soc-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index aae450ba4f08..8c6b688837de 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1106,8 +1106,8 @@ static int soc_init_dai_link(struct snd_soc_card *card,
 		 * Codec must be specified by 1 of name or OF node,
 		 * not both or neither.
 		 */
-		if (!!codec->name ==
-		    !!codec->of_node) {
+		if (!codec->name ==
+		    !codec->of_node) {
 			dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n",
 				link->name);
 			return -EINVAL;
-- 
2.17.1



More information about the Alsa-devel mailing list