mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] ALSA: Improve style of pnp_device_id array terminators
@ 2026-06-09 16:46 Uwe Kleine-König (The Capable Hub)
  2026-06-09 18:38 ` Jaroslav Kysela
  2026-06-10  7:25 ` Takashi Iwai
  0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-09 16:46 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai; +Cc: linux-sound, linux-kernel

To match how device-id array terminators look like for other device
types drop `.id = ""` from it and let the compiler care for zeroing the
entry.

There are no changes in the compiled drivers, only the source looks
nicer.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
---
 sound/drivers/mpu401/mpu401.c | 2 +-
 sound/isa/cs423x/cs4236.c     | 2 +-
 sound/isa/es18xx.c            | 2 +-
 sound/isa/opl3sa2.c           | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index b615a310c79a..c217c427bf1e 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -123,7 +123,7 @@ static struct platform_driver snd_mpu401_driver = {
 
 static const struct pnp_device_id snd_mpu401_pnpids[] = {
 	{ .id = "PNPb006" },
-	{ .id = "" }
+	{ }
 };
 
 MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 238065ffa1d2..ecce31b348b0 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -94,7 +94,7 @@ static const struct pnp_device_id snd_cs423x_pnpbiosids[] = {
 	/* Guillemot Turtlebeach something appears to be cs4232 compatible
 	 * (untested) */
 	{ .id = "GIM0100" },
-	{ .id = "" }
+	{ }
 };
 MODULE_DEVICE_TABLE(pnp, snd_cs423x_pnpbiosids);
 
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 1a02da1679d0..3cadbf7cf238 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1935,7 +1935,7 @@ static int pnpc_registered __ro_after_init;
 static const struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
 	{ .id = "ESS1869" },
 	{ .id = "ESS1879" },
-	{ .id = "" }		/* end */
+	{ }			/* end */
 };
 
 MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids);
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 88eada933a1f..66b1e361c101 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -125,7 +125,7 @@ struct snd_opl3sa2 {
 static const struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
 	{ .id = "YMH0021" },
 	{ .id = "NMX2210" },	/* Gateway Solo 2500 */
-	{ .id = "" }		/* end */
+	{ }			/* end */
 };
 
 MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids);

base-commit: a87737435cfa134f9cdcc696ba3080759d04cf72
-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ALSA: Improve style of pnp_device_id array terminators
  2026-06-09 16:46 [PATCH v1] ALSA: Improve style of pnp_device_id array terminators Uwe Kleine-König (The Capable Hub)
@ 2026-06-09 18:38 ` Jaroslav Kysela
  2026-06-09 19:20   ` Uwe Kleine-König (The Capable Hub)
  2026-06-10  7:25 ` Takashi Iwai
  1 sibling, 1 reply; 5+ messages in thread
From: Jaroslav Kysela @ 2026-06-09 18:38 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub), Takashi Iwai
  Cc: linux-sound, linux-kernel

On 6/9/26 18:46, Uwe Kleine-König (The Capable Hub) wrote:
> To match how device-id array terminators look like for other device
> types drop `.id = ""` from it and let the compiler care for zeroing the
> entry.
> 
> There are no changes in the compiled drivers, only the source looks
> nicer.

It's not true. Unless the matching and lookup functions are not changed, 
there's difference between NULL pointer and pointer to an empty string.

See match_device in drivers/pnp/driver.c - "while (*drv_id->id)". Your change 
will cause NULL pointer dereference.

					Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ALSA: Improve style of pnp_device_id array terminators
  2026-06-09 18:38 ` Jaroslav Kysela
@ 2026-06-09 19:20   ` Uwe Kleine-König (The Capable Hub)
  2026-06-09 19:26     ` Jaroslav Kysela
  0 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König (The Capable Hub) @ 2026-06-09 19:20 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, linux-sound, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 798 bytes --]

On Tue, Jun 09, 2026 at 08:38:57PM +0200, Jaroslav Kysela wrote:
> On 6/9/26 18:46, Uwe Kleine-König (The Capable Hub) wrote:
> > To match how device-id array terminators look like for other device
> > types drop `.id = ""` from it and let the compiler care for zeroing the
> > entry.
> > 
> > There are no changes in the compiled drivers, only the source looks
> > nicer.
> 
> It's not true. Unless the matching and lookup functions are not changed,
> there's difference between NULL pointer and pointer to an empty string.
> 
> See match_device in drivers/pnp/driver.c - "while (*drv_id->id)". Your
> change will cause NULL pointer dereference.

That's an easy but wrong diagnosis that I fell for first, too. Note that
.id is not a pointer but a char array.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ALSA: Improve style of pnp_device_id array terminators
  2026-06-09 19:20   ` Uwe Kleine-König (The Capable Hub)
@ 2026-06-09 19:26     ` Jaroslav Kysela
  0 siblings, 0 replies; 5+ messages in thread
From: Jaroslav Kysela @ 2026-06-09 19:26 UTC (permalink / raw)
  To: Uwe Kleine-König (The Capable Hub)
  Cc: Takashi Iwai, linux-sound, linux-kernel

On 6/9/26 21:20, Uwe Kleine-König (The Capable Hub) wrote:
> On Tue, Jun 09, 2026 at 08:38:57PM +0200, Jaroslav Kysela wrote:
>> On 6/9/26 18:46, Uwe Kleine-König (The Capable Hub) wrote:
>>> To match how device-id array terminators look like for other device
>>> types drop `.id = ""` from it and let the compiler care for zeroing the
>>> entry.
>>>
>>> There are no changes in the compiled drivers, only the source looks
>>> nicer.
>>
>> It's not true. Unless the matching and lookup functions are not changed,
>> there's difference between NULL pointer and pointer to an empty string.
>>
>> See match_device in drivers/pnp/driver.c - "while (*drv_id->id)". Your
>> change will cause NULL pointer dereference.
> 
> That's an easy but wrong diagnosis that I fell for first, too. Note that
> .id is not a pointer but a char array.

Right. Apologize for the noise. Thanks

				Jaroslav

-- 
Jaroslav Kysela <perex@perex.cz>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] ALSA: Improve style of pnp_device_id array terminators
  2026-06-09 16:46 [PATCH v1] ALSA: Improve style of pnp_device_id array terminators Uwe Kleine-König (The Capable Hub)
  2026-06-09 18:38 ` Jaroslav Kysela
@ 2026-06-10  7:25 ` Takashi Iwai
  1 sibling, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2026-06-10  7:25 UTC (permalink / raw)
  To: "Uwe Kleine-König (The Capable Hub)"
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel

On Tue, 09 Jun 2026 18:46:10 +0200,
Uwe Kleine-König (The Capable Hub) wrote:
> 
> To match how device-id array terminators look like for other device
> types drop `.id = ""` from it and let the compiler care for zeroing the
> entry.
> 
> There are no changes in the compiled drivers, only the source looks
> nicer.
> 
> Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>

Applied to for-next branch now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-06-10  7:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-09 16:46 [PATCH v1] ALSA: Improve style of pnp_device_id array terminators Uwe Kleine-König (The Capable Hub)
2026-06-09 18:38 ` Jaroslav Kysela
2026-06-09 19:20   ` Uwe Kleine-König (The Capable Hub)
2026-06-09 19:26     ` Jaroslav Kysela
2026-06-10  7:25 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®