Re: [PATCH 0/6] Return -ENODEV instead of -EFAULT on module-get failure

From: Cezary Rojewski

Date: Mon Jul 06 2026 - 06:52:03 EST


On 7/6/2026 10:49 AM, phucduc.bui@xxxxxxxxx wrote:
From: bui duc phuc <phucduc.bui@xxxxxxxxx>

Hi all,

Several ALSA open/allocate paths call try_module_get() on the owning card
module and return -EFAULT when it fails. However, try_module_get() fails
when the module is no longer live (i.e. it is going away), meaning the
device is no longer usable.
This series updates only those paths, making the error code consistent
with the existing "device unavailable" checks in the same functions.
Other -EFAULT returns are left unchanged.
No functional change is intended.
Changing a return code _is_ a functional change, so the last statement is bogus.

Now, there is a benefit of having a different error code in try_module_get() case: easier to find the offending bit when viewing logs. All the functions in the area have rather low log-coverage so distinct error codes help.

Regardless, as you mentioned, -EFAULT isn't exactly the right return code either so the direction of the patchset is good.