[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87ldvgtp36.wl-tiwai@suse.de>
Date: Sun, 12 Jan 2025 09:26:37 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Baojun Xu <baojun.xu@...com>
Cc: <tiwai@...e.de>,
<robh+dt@...nel.org>,
<andriy.shevchenko@...ux.intel.com>,
<lgirdwood@...il.com>,
<perex@...ex.cz>,
<shenghao-ding@...com>,
<navada@...com>,
<13916275206@....com>,
<v-hampiholi@...com>,
<v-po@...com>,
<linux-sound@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<liam.r.girdwood@...el.com>,
<yung-chuan.liao@...ux.intel.com>,
<broonie@...nel.org>,
<antheas.dk@...il.com>,
<stuart.a.hayhurst@...il.com>,
<dan.carpenter@...aro.org>
Subject: Re: [PATCH v1] ALSA: hda/tas2781: Ignore SUBSYS_ID not found for tas2563 projects
On Sat, 11 Jan 2025 10:57:28 +0100,
Baojun Xu wrote:
>
> Driver will return error if no SUBSYS_ID found in BIOS(acpi).
> It will cause error in tas2563 projects, which have no SUBSYS_ID.
> Change strncmp to strcmp to avoid warning for weird length.
I don't understand the logic.
The use of strncmp() there already matches only with the exact string
"INT8866", not the substring, because you use sizeof("INT8866") which
is 8 including the NUL-terminator.
The only merit of strncmp() in this case is that it can be used for an
unterminated char array.
In which situation do you see the problem and how does your patch
improve / fix it? Please give a more concrete example.
thanks,
Takashi
>
> Signed-off-by: Baojun Xu <baojun.xu@...com>
> ---
> sound/pci/hda/tas2781_hda_i2c.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
> index 0e42b87dadb8..61aec92f6536 100644
> --- a/sound/pci/hda/tas2781_hda_i2c.c
> +++ b/sound/pci/hda/tas2781_hda_i2c.c
> @@ -143,7 +143,7 @@ static int tas2781_read_acpi(struct tasdevice_priv *p, const char *hid)
> sub = acpi_get_subsystem_id(ACPI_HANDLE(physdev));
> if (IS_ERR(sub)) {
> /* No subsys id in older tas2563 projects. */
> - if (!strncmp(hid, "INT8866", sizeof("INT8866")))
> + if (!strcmp(hid, "INT8866"))
> goto end_2563;
> dev_err(p->dev, "Failed to get SUBSYS ID.\n");
> ret = PTR_ERR(sub);
> --
> 2.43.0
>
>
Powered by blists - more mailing lists