All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Fitzgerald <rf@opensource.cirrus.com>
To: <tiwai@suse.com>
Cc: <perex@perex.cz>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>
Subject: [PATCH 9/9] ALSA: hda/cs35l56: Reject I2C alias addresses
Date: Mon, 31 Jul 2023 17:57:26 +0100	[thread overview]
Message-ID: <20230731165726.7940-10-rf@opensource.cirrus.com> (raw)
In-Reply-To: <20230731165726.7940-1-rf@opensource.cirrus.com>

The ACPI nodes for CS35L56 can contain an extra I2CSerialBusV2 that
is not a real device, it is an alias address.

This alias address will not be in the cirrus,dev-index array, so reject
any instantions with a device address not found in the array.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
---
 sound/pci/hda/cs35l56_hda.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
index 004740509dbd..76b9c685560b 100644
--- a/sound/pci/hda/cs35l56_hda.c
+++ b/sound/pci/hda/cs35l56_hda.c
@@ -852,8 +852,12 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
 			break;
 		}
 	}
+	/*
+	 * It's not an error for the ID to be missing: for I2C there can be
+	 * an alias address that is not a real device. So reject silently.
+	 */
 	if (cs35l56->index == -1) {
-		dev_err(cs35l56->base.dev, "No index found in %s\n", property);
+		dev_dbg(cs35l56->base.dev, "No index found in %s\n", property);
 		ret = -ENODEV;
 		goto err;
 	}
@@ -891,7 +895,8 @@ static int cs35l56_hda_read_acpi(struct cs35l56_hda *cs35l56, int id)
 	return 0;
 
 err:
-	dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret);
+	if (ret != -ENODEV)
+		dev_err(cs35l56->base.dev, "Failed property %s: %d\n", property, ret);
 
 	return ret;
 }
@@ -904,10 +909,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
 	dev_set_drvdata(cs35l56->base.dev, cs35l56);
 
 	ret = cs35l56_hda_read_acpi(cs35l56, id);
-	if (ret) {
-		dev_err_probe(cs35l56->base.dev, ret, "Platform not supported\n");
+	if (ret)
 		goto err;
-	}
 
 	cs35l56->amp_name = devm_kasprintf(cs35l56->base.dev, GFP_KERNEL, "AMP%d",
 					   cs35l56->index + 1);
-- 
2.30.2


  parent reply	other threads:[~2023-07-31 17:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 16:57 [PATCH 0/9] ALSA: hda/cs35l56: Various bugfixes Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 1/9] ALSA: hda/cs35l56: Complete firmware reboot before calling cs_dsp_run() Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 2/9] ALSA: hda/cs35l56: Do not mark cache dirty after REINIT Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 3/9] ALSA: hda/cs35l56: Call cs_dsp_power_down() before reloading firmware Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 4/9] ALSA: hda/cs35l56: Always power-up and start cs_dsp Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 5/9] ALSA: hda/cs35l56: Call cs_dsp_power_down() before calling cs_dsp_remove() Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 6/9] ALSA: hda/cs35l56: cs_dsp_power_down() on cs35l56_hda_fw_load() error path Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 7/9] ALSA: hda/cs35l56: Do not download firmware over existing RAM firmware Richard Fitzgerald
2023-07-31 16:57 ` [PATCH 8/9] ALSA: hda/cs35l56: Fail if .bin not found and firmware not patched Richard Fitzgerald
2023-07-31 16:57 ` Richard Fitzgerald [this message]
2023-08-01  6:30 ` [PATCH 0/9] ALSA: hda/cs35l56: Various bugfixes Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230731165726.7940-10-rf@opensource.cirrus.com \
    --to=rf@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.