Skip to contentSkip to conversation

ALSA: hda: tas2781-spi: Delete some dead code

PATCH New Dan Carpenter 1 participant 2 messages Jan 22, 2025 1 message not in the archive Sound

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 ALSA: hda: tas2781-spi: Delete some dead code

In reply to a message not in the archive

The scnprintf() function never returns negatives. And it won't return zero here either, plus if it did we'd need to fix the error code. Delete this dead code.

---
 sound/pci/hda/tas2781_hda_spi.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
sound/pci/hda/tas2781_hda_spi.c +1 -5
index 5be71b538ce0..02794fd6003d 100644
@@ -274,13 +274,9 @@ static int tascodec_spi_init(struct tasdevice_priv *tas_priv,
 	 */
 	guard(mutex)(&tas_priv->codec_lock);
 
-	ret = scnprintf(tas_priv->rca_binaryname,
+	scnprintf(tas_priv->rca_binaryname,
 		sizeof(tas_priv->rca_binaryname), "%sRCA%d.bin",
 		tas_priv->dev_name, tas_priv->index);
-	if (ret <= 0) {
-		dev_err(tas_priv->dev, "rca name err:0x%08x\n", ret);
-		return ret;
-	}
 	crc8_populate_msb(tas_priv->crc8_lkp_tbl, TASDEVICE_CRC8_POLYNOMIAL);
 	tas_priv->codec = codec;
 	ret = request_firmware_nowait(module, FW_ACTION_UEVENT,
Signature · 1 line
2.45.2
#2 lore raw

PATCH 2/2 ALSA: hda: tas2781-spi: Fix error code in tas2781_read_acpi()

In reply to a message not in the archive

Propagate the error code from devm_gpiod_get_index_optional(). The current code returns success.

Fixes bb5f86ea50ff ("ALSA: hda/tas2781: Add tas2781 hda SPI driver")
---
 sound/pci/hda/tas2781_hda_spi.c | 1 +
 1 file changed, 1 insertion(+)
sound/pci/hda/tas2781_hda_spi.c +1 -0
index 02794fd6003d..eba9c3a3b944 100644
@@ -447,6 +447,7 @@ static int tas2781_read_acpi(struct tas2781_hda *tas_hda,
 		p->reset = devm_gpiod_get_index_optional(physdev, "reset",
 			p->index, GPIOD_OUT_LOW);
 		if (IS_ERR(p->reset)) {
+			ret = PTR_ERR(p->reset);
 			dev_err_probe(p->dev, ret, "Failed on reset GPIO\n");
 			goto err;
 		}
Signature · 1 line
2.45.2