Skip to contentSkip to conversation

mfd: cs42l43: Remove redundant NULL checks on SoundWire

PATCH Applied Charles Keepax 3 participants 4 messages Jul 8 – Jul 16

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

PATCH 1/1 mfd: cs42l43: Remove redundant NULL checks on SoundWire

The SoundWire core helpers now check for NULL on the SoundWire peripheral so there is no need to do so locally, remove the duplicate checks.

---
 drivers/mfd/cs42l43.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/mfd/cs42l43.c +3 -6
index d2bbd2f18af7d..33479ddd539a6 100644
@@ -588,12 +588,9 @@ static int cs42l43_wait_for_attach(struct cs42l43 *cs42l43)
 {
 	int ret;
 
-	if (cs42l43->sdw) {
-		ret = sdw_slave_wait_for_init(cs42l43->sdw,
-					      CS42L43_SDW_ATTACH_TIMEOUT_MS);
-		if (ret)
-			return ret;
-	}
+	ret = sdw_slave_wait_for_init(cs42l43->sdw, CS42L43_SDW_ATTACH_TIMEOUT_MS);
+	if (ret)
+		return ret;
 
 	regcache_cache_only(cs42l43->regmap, false);
 
Signature · 1 line
2.47.3
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but hard-coding MFD cell device IDs with PLATFORM_DEVID_NONE violates subsystem guidelines and can lead to sysfs naming collisions. --

--- Patch [1]: [PATCH] mfd: cs42l43: Remove redundant NULL checks on SoundWire --- commit 19ffc73222838697334faab6f7e91a44c4692edc
Author: Charles Keepax <[email protected]>

mfd: cs42l43: Remove redundant NULL checks on SoundWire

The SoundWire core helpers now check for NULL on the SoundWire peripheral so there is no need to do so locally, remove the duplicate checks.

Quoted 9 lines
drivers/mfd/cs42l43.c +0 -1
index d2bbd2f18af7d..33479ddd539a6 100644
@@ -588,12 +588,9 @@ static int cs42l43_wait_for_attach(struct cs42l43 *cs42l43)
 {
 	int ret;
 
-	if (cs42l43->sdw) {

drivers/mfd/cs42l43.c static int cs42l43_wait_for_attach(struct cs42l43 *cs42l43) · line 595

Quoted 10 lines
drivers/mfd/cs42l43.c +3 -5
-		ret = sdw_slave_wait_for_init(cs42l43->sdw,
-					      CS42L43_SDW_ATTACH_TIMEOUT_MS);
-		if (ret)
-			return ret;
-	}
+	ret = sdw_slave_wait_for_init(cs42l43->sdw, CS42L43_SDW_ATTACH_TIMEOUT_MS);
+	if (ret)
+		return ret;
 
 	regcache_cache_only(cs42l43->regmap, false);

While reviewing this commit, I noticed a pre-existing issue in the same file:

drivers/mfd/cs42l43.c:cs42l43_boot_work() {
    ...
	ret = devm_mfd_add_devices(cs42l43->dev, PLATFORM_DEVID_NONE,
				   cs42l43_devs, ARRAY_SIZE(cs42l43_devs),
				   NULL, 0, NULL);
    ...
}

[Severity: High]
This isn't a bug introduced by this patch, but does the hard-coded PLATFORM_DEVID_NONE here prevent automatic cell indexing?

If multiple CS42L43 devices are instantiated, the second instance's attempt to register its subdevices could cause a kobject naming collision on the platform bus since there is no index. Should this use PLATFORM_DEVID_AUTO instead?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw
Quoted 4 lines · On Wed, Jul 08, 2026 at 10:16:50AM +0000, [email protected] wrote:

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but hard-coding MFD cell device IDs with PLATFORM_DEVID_NONE violates subsystem guidelines and can lead to sysfs naming collisions.

Yeah this is true, however a) the chances of multiple cs42l43 systems is quite low, if one is coming up we will spend more cycles on this issue, and b) unfortunately there is fairly major surgery to be done on the Intel machine driver stuff to facilitate this. It currently relies on the naming to identify the audio dai links.

Thanks,
Charles

maintainer Applied
#3 lore raw

Re: (subset) [PATCH] mfd: cs42l43: Remove redundant NULL checks on SoundWire

In reply to Charles Keepax
Quoted 3 lines · Charles Keepax

The SoundWire core helpers now check for NULL on the SoundWire peripheral so there is no need to do so locally, remove the duplicate checks.

Applied, thanks!

[1/1] mfd: cs42l43: Remove redundant NULL checks on SoundWire

      commit: aa6e7336a9cae7a4c90c74e302fd38f7da93ffc3

--
Lee Jones [李琼斯]