public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: avs: replace strcmp with sysfs_streq
@ 2025-12-21 18:55 Brahmajit Das
  2025-12-23 17:07 ` Mark Brown
  0 siblings, 1 reply; 12+ messages in thread
From: Brahmajit Das @ 2025-12-21 18:55 UTC (permalink / raw)
  To: linux-sound, linux-next
  Cc: cezary.rojewski, broonie, liam.r.girdwood, peter.ujfalusi, tiwai,
	listout

allmodconfig failes to build with GCC 16 with the following build error

sound/soc/intel/avs/path.c:137:38: error: ‘strcmp’ reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
  137 |         return id->id == id2->id && !strcmp(id->tplg_name, id2->tplg_name);
      |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘avs_condpaths_walk’: events 1-3
  137 |         return id->id == id2->id && !strcmp(id->tplg_name, id2->tplg_name);
      |                ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                  |   |
      |                                  |   (3) warning happens here
      |                                  (1) when the condition is evaluated to true
......
  155 |         if (id->id != path->template->owner->id ||
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                 |
      |                                                 (2) when the condition is evaluated to false
  156 |             strcmp(id->tplg_name, path->template->owner->owner->name))
      |             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from sound/soc/intel/avs/path.h:14,
                 from sound/soc/intel/avs/path.c:15:
sound/soc/intel/avs/topology.h: In function ‘avs_condpaths_walk’:
sound/soc/intel/avs/topology.h:152:13: note: at offset 4 into source object ‘id’ of size 4
  152 |         u32 id;
      |             ^~

Using the sysfs_streq as an alternative to strcmp helps getting around
this build failure.
Please also refer
https://docs.kernel.org/core-api/kernel-api.html#c.__sysfs_match_string

Signed-off-by: Brahmajit Das <listout@listout.xyz>
---
There are other instances of strcmp in the file, which I've not touched
since I'm not sure if they need to replaced and compiler specifically
complained about this instance only.

The idea about using sysfs_streq comes from the kernel documentations
about __sysfs_match_string where in the description it is mentioned
"Uses sysfs_streq instead of strcmp for matching."
---
 sound/soc/intel/avs/path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c
index 7aa20fcf1a33..0c66c8bb2f89 100644
--- a/sound/soc/intel/avs/path.c
+++ b/sound/soc/intel/avs/path.c
@@ -134,7 +134,7 @@ static struct avs_tplg_path *avs_condpath_find_variant(struct avs_dev *adev,
 static bool avs_tplg_path_template_id_equal(struct avs_tplg_path_template_id *id,
 					    struct avs_tplg_path_template_id *id2)
 {
-	return id->id == id2->id && !strcmp(id->tplg_name, id2->tplg_name);
+	return id->id == id2->id && !sysfs_streq(id->tplg_name, id2->tplg_name);
 }
 
 static struct avs_path *avs_condpath_find_match(struct avs_dev *adev,
-- 
2.52.0


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

end of thread, other threads:[~2025-12-30 14:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-21 18:55 [PATCH] ASoC: Intel: avs: replace strcmp with sysfs_streq Brahmajit Das
2025-12-23 17:07 ` Mark Brown
2025-12-23 18:24   ` Amadeusz Sławiński
2025-12-23 20:57     ` Brahmajit Das
2025-12-24 10:05       ` Takashi Iwai
2025-12-24 11:35         ` Mark Brown
2025-12-29 10:03           ` Cezary Rojewski
2025-12-30  7:59             ` Brahmajit Das
2025-12-30  8:32             ` Brahmajit Das
2025-12-30  9:36               ` Cezary Rojewski
2025-12-30 12:25                 ` Amadeusz Sławiński
2025-12-30 14:47                   ` Richard Biener

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