ALSA: hda: simplify match functions and remove unreachable return

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>
Link: https://patch.msgid.link/20260812033007.633564-1-songxiebing@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Bob Song 2026-08-12 11:30:07 +08:00 committed by Takashi Iwai
parent 21e958c4fd
commit 67300656f6

View File

@ -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)