Re: [PATCH v1] ALSA: Improve style of pnp_device_id array terminators

From: Jaroslav Kysela

Date: Tue Jun 09 2026 - 15:38:53 EST


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@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.