RE: [patch V2 07/33] genirq/msi: Provide msi_create/free_device_irq_domain()

From: Tian, Kevin
Date: Wed Nov 23 2022 - 20:07:16 EST


> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Sent: Wednesday, November 23, 2022 7:38 PM
>
> >> + *
> >> + * Return: True on success, false otherwise
> >
> > Can you elaborate why boolean type is selected instead of returning the
> > actual error codes? the outmost callers are all new functions:
> >
> > pci_setup_msi[x]_device_domain()
> > pci_create_ims_domain()
> >
> > I didn't find out any legacy convention forcing this way...
>
> What's the value of error codes? 99% of all callsites do:
>
> ret = foo();
> if (ret)
> goto fail;
>
> Nothing evaluates the error codes, unless there is real useful
> information like EAGAIN or ENOSPC which can tell the caller to retry
> eventually or with different parameters. But for the above, the error
> code is just useless.
>

I looked at it from the outmost invocation:

@@ -436,6 +436,9 @@ int __pci_enable_msi_range(struct pci_de
if (rc)
return rc;

+ if (!pci_setup_msi_device_domain(dev))
+ return -ENODEV;
+

the current style kind of converts meaningful -EINVAL/-ENOMEM/etc.
into -ENODEV.