Skip to contentSkip to conversation

ALSA: oxfw: fix detect_loud_models() return value

PATCH Applied Dan Carpenter 3 participants 3 messages Dec 12, 2014 – Dec 14, 2014

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

PATCH 2/2 ALSA: oxfw: fix detect_loud_models() return value

This code causes a static checker warning:

sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
warn: signedness bug returning '(-2)'

The detect_loud_models() function should return false on falure, so that we don't try to set up the loud code for hardware that doesn't support it.

sound/firewire/oxfw/oxfw.c +1 -1
index cf1d0b5..60e5cad 100644
@@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
 	err = fw_csr_string(unit->directory, CSR_MODEL,
 			    model, sizeof(model));
 	if (err < 0)
-		return err;
+		return false;
 
 	for (i = 0; i < ARRAY_SIZE(models); i++) {
 		if (strcmp(models[i], model) == 0)
maintainer
#1 lore raw
Quoted 16 lines · Dan Carpenter

This code causes a static checker warning:

sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
warn: signedness bug returning '(-2)'

The detect_loud_models() function should return false on falure, so that we don't try to set up the loud code for hardware that doesn't support it.

sound/firewire/oxfw/oxfw.c +0 -0
index cf1d0b5..60e5cad 100644

sound/firewire/oxfw/oxfw.c static bool detect_loud_models(struct fw_unit *unit) · line 49

Quoted 8 lines
sound/firewire/oxfw/oxfw.c +1 -1
@@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
 	err = fw_csr_string(unit->directory, CSR_MODEL,
 			    model, sizeof(model));
 	if (err < 0)
-		return err;
+		return false;
 
 	for (i = 0; i < ARRAY_SIZE(models); i++) {
 		if (strcmp(models[i], model) = 0)

Thanks

Takashi Sakamoto
[email protected]

Applied
#2 lore raw

At Sat, 13 Dec 2014 13:45:55 +0900,

Quoted 24 lines · Takashi Sakamoto
Quoted 22 lines · Dan Carpenter

This code causes a static checker warning:

sound/firewire/oxfw/oxfw.c:46 detect_loud_models()
warn: signedness bug returning '(-2)'

The detect_loud_models() function should return false on falure, so that we don't try to set up the loud code for hardware that doesn't support it.

sound/firewire/oxfw/oxfw.c +1 -1
index cf1d0b5..60e5cad 100644
@@ -43,7 +43,7 @@ static bool detect_loud_models(struct fw_unit *unit)
 	err = fw_csr_string(unit->directory, CSR_MODEL,
 			    model, sizeof(model));
 	if (err < 0)
-		return err;
+		return false;
 
Quoted 4 lines

sound/firewire/oxfw/oxfw.c static bool detect_loud_models(struct fw_unit *unit) · line 49

Quoted 2 lines
sound/firewire/oxfw/oxfw.c +0 -0
 	for (i = 0; i < ARRAY_SIZE(models); i++) {
 		if (strcmp(models[i], model) = 0)

Applied this one now. Thanks.

(The second one is still pending, waiting for the final decision for a
while.)

Takashi