Skip to contentSkip to conversation

Annotate pm_runtime_resume_and_get() as __must_check ?

DISCUSSION Heiner Kallweit 2 participants 3 messages Jul 31, 2021 – Dec 23, 2021 Crypto API

lore
Share & tools
lore
#0 lore raw

Seeing an erroneous use of pm_runtime_resume_and_get() in a patch I wonder whether we should annotate this function as __must_check. If the caller doesn't check the return code he doesn't know whether usage counter was bumped or not. Therefore I see a good chance that this results in a usage counter imbalance.

#1 lore raw
Quoted 6 lines · Heiner Kallweit

Seeing an erroneous use of pm_runtime_resume_and_get() in a patch I wonder whether we should annotate this function as __must_check. If the caller doesn't check the return code he doesn't know whether usage counter was bumped or not. Therefore I see a good chance that this results in a usage counter imbalance.

Sounds reasonable. Please send a patch to make that change.

#2 lore raw
Quoted 9 lines · Rafael J. Wysocki
Quoted 6 lines · Heiner Kallweit

Seeing an erroneous use of pm_runtime_resume_and_get() in a patch I wonder whether we should annotate this function as __must_check. If the caller doesn't check the return code he doesn't know whether usage counter was bumped or not. Therefore I see a good chance that this results in a usage counter imbalance.

Sounds reasonable. Please send a patch to make that change.

It took some time to fix the callers that use pm_runtime_resume_and_get() w/o checking the return code. Last pending patch is [0], all other fixes are available on linux-next meanwhile.
I'll submit the patch to annotate pm_runtime_resume_and_get() as __must_check, so that we hopefully can get this into 5.17 (incl. pending [0]).

[0] https://lore.kernel.org/all/[email protected]/T/