[PATCH v6 1/5] iommu: Return -EMEDIUMTYPE for incompatible domain and device/group

Joerg Roedel joro at 8bytes.org
Wed Sep 7 07:06:29 PDT 2022


On Wed, Sep 07, 2022 at 10:47:39AM -0300, Jason Gunthorpe wrote:
> Would you be happier if we wrote it like
> 
>  #define IOMMU_EINCOMPATIBLE_DEVICE xx
> 
> Which tells "which of the function parameters is actually invalid" ?

Having done some Rust hacking in the last months, I have to say I like
to concept of error handling with Result<> there. Ideally we have a way
to emulate that in our C code without having to change all callers.

What I am proposing is a way this could be emulated here, but I am open
to other suggestions. Still better than re-using random error codes for
special purposes.

Regards,

	Joerg



More information about the linux-arm-kernel mailing list