On Wed, 2018-02-28 at 14:14 +0000, Andrew Cooper wrote:
> The main purpose of this change is for the subsequent cleanup it
> enables, but
> it stands on its own merits.
> 
> In principle, these hooks are optional, but the SCHED_OP() default
> aliases a
> memory allocation failure, which causes arinc653 to play the
> dangerous game of
> passing its priv pointer back, and remembering not to actually free
> it.
> 
> Redefine alloc_domdata to use ERR_PTR() for errors, NULL for nothing,
> and
> non-NULL for a real allocation, which allows the hook to become
> properly
> optional.  Redefine free_domdata to be idempotent.
> 
> For arinc653, this means the dummy hooks can be dropped
> entirely.  For the
> other schedulers, this means returning ERR_PTR(-ENOMEM) instead of
> NULL for
> memory allocation failures, and modifying the free hooks to cope with
> a NULL
> pointer.  While making the alterations, drop some spurious casts to
> void *.
> 
> Introduce and use proper wrappers for
> sched_{alloc,free}_domdata().  These are
> strictly better than SCHED_OP(), as the source code is visible to
> grep/cscope/tags, the generated code is better, and there can be
> proper
> per-hook defaults and checks.
> 
> Callers of the alloc hooks are switched to using IS_ERR(), rather
> than
> checking for NULL.
> 
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>
>
Reviewed-by: Dario Faggioli <dfaggi...@suse.com>

Regards,
Dario
-- 
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Software Engineer @ SUSE https://www.suse.com/

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to