Could you please fix the subject, changing dmr to drm?
Ups! Sure, I'll fix that. Thanks for noticing.
I think you can just reuse 'ret' instead of creating a new variable. That ensures if the lock fails we return the error from the macros.
I didn't reuse "ret" because otherwise I would have had to change the prototype of the function (which currently returns a "bool" instead of an "int").
However I could, for example, check for any error and convert that into "false". Would that be ok?