mirror of
https://github.com/torvalds/linux
synced 2024-11-02 18:48:59 +00:00
PCI/MSI: Make error path handling follow the standard pattern
Make error path handling follow the standard pattern, i.e. checking for errors first. This makes code much easier to read and understand despite being a bit longer. Link: https://lore.kernel.org/r/20240426144039.557907-1-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
4cece76496
commit
0ba5cd94bb
1 changed files with 9 additions and 6 deletions
|
@ -86,9 +86,11 @@ static int pcim_setup_msi_release(struct pci_dev *dev)
|
|||
return 0;
|
||||
|
||||
ret = devm_add_action(&dev->dev, pcim_msi_release, dev);
|
||||
if (!ret)
|
||||
dev->is_msi_managed = true;
|
||||
return ret;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev->is_msi_managed = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -99,9 +101,10 @@ static int pci_setup_msi_context(struct pci_dev *dev)
|
|||
{
|
||||
int ret = msi_setup_device_data(&dev->dev);
|
||||
|
||||
if (!ret)
|
||||
ret = pcim_setup_msi_release(dev);
|
||||
return ret;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return pcim_setup_msi_release(dev);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue