Re: [PATCH 02/22] PCI: Unify PCI error response checking

From: Bjorn Helgaas
Date: Wed Oct 13 2021 - 14:48:48 EST


On Wed, Oct 13, 2021 at 10:46:53PM +0530, Naveen Naidu wrote:

> 2. "Rework any callers expecting a positive return value"
>
> This means, find out the places where we have something like
>
> err = pci_read_config_dword();
> if (err > 0)
>
> Then change it to:
>
> err = pci_read_config_dword(pdev, PCI_REG_NPKDSC, &npkdsc);
> if (err != PCIBIOS_SUCCESSFUL)

I'm sure this is obvious, but I would try hard not to add any new uses
of PCIBIOS_SUCCESSFUL.

> Is there any easy way to search for these patterns, or should I look
> for each instance of pci_read_config_* and other such variants and
> see if such an case exists?

coccigrep might be able to find things like this, but I'ver never
really become friends with it.