public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Baojun Xu <baojun.xu@ti.com>
Cc: <tiwai@suse.de>, <robh+dt@kernel.org>,
	<andriy.shevchenko@linux.intel.com>, <lgirdwood@gmail.com>,
	<perex@perex.cz>, <shenghao-ding@ti.com>, <navada@ti.com>,
	<13916275206@139.com>, <v-hampiholi@ti.com>, <v-po@ti.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<liam.r.girdwood@intel.com>, <yung-chuan.liao@linux.intel.com>,
	<broonie@kernel.org>, <antheas.dk@gmail.com>,
	<stuart.a.hayhurst@gmail.com>, <dan.carpenter@linaro.org>
Subject: Re: [PATCH v1] ALSA: hda/tas2781: Ignore SUBSYS_ID not found for tas2563 projects
Date: Sun, 12 Jan 2025 09:26:37 +0100	[thread overview]
Message-ID: <87ldvgtp36.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250111095728.1232-1-baojun.xu@ti.com>

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@ti.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
> 
> 

  reply	other threads:[~2025-01-12  8:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-11  9:57 [PATCH v1] ALSA: hda/tas2781: Ignore SUBSYS_ID not found for tas2563 projects Baojun Xu
2025-01-12  8:26 ` Takashi Iwai [this message]
2025-01-13  5:33   ` Dan Carpenter
2025-01-13  6:41   ` [EXTERNAL] " Xu, Baojun
2025-01-13  7:47     ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2024-12-30  6:49 Baojun Xu
2024-12-30 10:40 ` Takashi Iwai
2025-01-13  8:37 ` Andy Shevchenko

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=87ldvgtp36.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=13916275206@139.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=antheas.dk@gmail.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=navada@ti.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=shenghao-ding@ti.com \
    --cc=stuart.a.hayhurst@gmail.com \
    --cc=v-hampiholi@ti.com \
    --cc=v-po@ti.com \
    --cc=yung-chuan.liao@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox