30 Mar
2023
30 Mar
'23
5:51 p.m.
On Mon, 27 Mar 2023 13:29:19 +0200, Peter Ujfalusi wrote:
int hda_bus_ml_get_capabilities(struct hdac_bus *bus) {
- if (bus->mlcap)
return snd_hdac_ext_bus_get_ml_capabilities(bus);
- u32 link_count;
- int ret;
- int i;
- if (!bus->mlcap)
return 0;
- link_count = readl(bus->mlcap + AZX_REG_ML_MLCD) + 1;
- dev_dbg(bus->dev, "HDAudio Multi-Link count: %d\n", link_count);
- for (i = 0; i < link_count; i++) {
ret = hda_ml_alloc_h2link(bus, i);
if (ret < 0) {
hda_bus_ml_free(bus);
return ret;
}
- } return 0;
This makes that each call of hda_bus_ml_get_capabilities() adds the h2link entries blindly. If the driver calls it multiple times mistakenly (the function name sounds as if it's just a helper to query the capability bits), it'll lead to doubly entries. Maybe adding some check would be safer, IMO.
thanks,
Takashi