* [PATCH] ALSA: hda: simplify match functions and remove unreachable return
@ 2026-08-12 3:30 songxiebing
2026-08-12 5:29 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: songxiebing @ 2026-08-12 3:30 UTC (permalink / raw)
To: tiwai, perex; +Cc: linux-sound, linux-kernel, songxiebing
From: Bob Song <songxiebing@kylinos.cn>
hda_bus_match() has an unreachable 'return 1' after an if/else that
covers both branches. Remove the superfluous return and simplify the
control flow by dropping the else branch.
hdac_codec_match() uses a redundant if/else to return 1 or 0.
Simplify to a single return statement.
Signed-off-by: Bob Song <songxiebing@kylinos.cn>
---
sound/hda/core/hda_bus_type.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/sound/hda/core/hda_bus_type.c b/sound/hda/core/hda_bus_type.c
index a4afd41b6f84..e1e986a8b5b5 100644
--- a/sound/hda/core/hda_bus_type.c
+++ b/sound/hda/core/hda_bus_type.c
@@ -39,10 +39,7 @@ EXPORT_SYMBOL_GPL(hdac_get_device_id);
static int hdac_codec_match(struct hdac_device *dev, const struct hdac_driver *drv)
{
- if (hdac_get_device_id(dev, drv))
- return 1;
- else
- return 0;
+ return !!hdac_get_device_id(dev, drv);
}
static int hda_bus_match(struct device *dev, const struct device_driver *drv)
@@ -59,9 +56,7 @@ static int hda_bus_match(struct device *dev, const struct device_driver *drv)
*/
if (hdrv->match)
return hdrv->match(hdev, hdrv);
- else
- return hdac_codec_match(hdev, hdrv);
- return 1;
+ return hdac_codec_match(hdev, hdrv);
}
static int hda_uevent(const struct device *dev, struct kobj_uevent_env *env)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: hda: simplify match functions and remove unreachable return
2026-08-12 3:30 [PATCH] ALSA: hda: simplify match functions and remove unreachable return songxiebing
@ 2026-08-12 5:29 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-08-12 5:29 UTC (permalink / raw)
To: songxiebing; +Cc: tiwai, perex, linux-sound, linux-kernel
On Wed, 12 Aug 2026 05:30:07 +0200,
songxiebing wrote:
>
> From: Bob Song <songxiebing@kylinos.cn>
>
> hda_bus_match() has an unreachable 'return 1' after an if/else that
> covers both branches. Remove the superfluous return and simplify the
> control flow by dropping the else branch.
>
> hdac_codec_match() uses a redundant if/else to return 1 or 0.
> Simplify to a single return statement.
>
> Signed-off-by: Bob Song <songxiebing@kylinos.cn>
Applied to for-next branch. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-12 5:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 3:30 [PATCH] ALSA: hda: simplify match functions and remove unreachable return songxiebing
2026-08-12 5:29 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox