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

From: Takashi Iwai

Date: Mon Jul 06 2026 - 09:38:11 EST


On Mon, 06 Jul 2026 15:13:15 +0200,
Cezary Rojewski wrote:
>
> On 7/6/2026 2:31 PM, Bui Duc Phuc wrote:
>
> >> 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.
> >
> > Should I also add dev_err() at these paths, or is the distinct error
> > code enough for now?
> Nah, typically I prefer not to mix the changes, let them remain
> atomic. Distinct error code is enough.
>
> In regard to the specific constant, I'd ask Takashi and Jaroslav
> what's their view on the subject. Perhaps -EPERM or -ENOENT are good
> candidates.

A quick grep showed the statics like:
85 ENODEV
41 EINVAL
17 EBUSY
16 EFAULT
14 ENOENT
10 EPROBE
8 EIO
6 ENXIO
3 EPROTONOSUPPORT
3 EAGAIN
3 EACCES
2 EXPORT
2 EPERM
2 ENOLCK
1 EPROTO
1 EOPNOTSUPP
1 ENOSYS
1 ENOPROTOOPT
1 EAFNOSUPPORT

So -ENODEV looks fine.


thanks,

Takashi