Messages in this thread | | | Date | Mon, 12 Jun 2023 07:57:37 -0500 | Subject | Re: [PATCH v13 17/24] gunyah: vm_mgr: Add framework for VM Functions | From | Alex Elder <> |
| |
On 6/9/23 2:49 PM, Elliot Berman wrote: >>> +static struct gh_vm_function *gh_vm_get_function(u32 type) >>> +{ >>> + struct gh_vm_function *fn; >>> + int r; >>> + >>> + fn = xa_load(&gh_vm_functions, type); >>> + if (!fn) { >>> + r = request_module("ghfunc:%d", type); >>> + if (r) >>> + return ERR_PTR(r > 0 ? -r : r); >> >> Almost all callers of request_module() simply ignore the >> return value. What positive values are you expecting to >> see here (and are you sure they're positive errno values)? >> > > I can ignore the return value here, too, to follow the convention. > > I had observed request_module can return modprobe's exit code.
I actually like checking the return value, but if a positive one comes back it's not clear at all that it should be interpreted as an errno.
Given that almost everybody ignores the return value, maybe the called function should change, but blk_request_module() and cpufreq_parse_governor() (for two examples) actually use the return value to affect behavior.
If you check its return, and it's positive, I would return a known negative errno rather than just negating it--and perhaps issue a warning. But it's OK with me if you just ignore it like most other callers.
-Alex
| |