]> git.itanic.dy.fi Git - linux-stable/commitdiff
scsi: ipr: Do PCI error checks on own line
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 11 Sep 2023 12:53:54 +0000 (15:53 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 10 Oct 2023 21:40:19 +0000 (16:40 -0500)
Instead of "if" conditions with line splits, use the usual error handling
pattern with a separate variable to improve readability.

No functional changes intended.

Link: https://lore.kernel.org/r/20230911125354.25501-7-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: "Martin K. Petersen" <martin.petersen@oracle.com>
drivers/scsi/ipr.c

index 4e13797b2a4abd3ea2d04d2edc510b29035ea918..81e3d464d1f6ad8a67963af99a900ea1a4240cc0 100644 (file)
@@ -761,12 +761,14 @@ static void ipr_mask_and_clear_interrupts(struct ipr_ioa_cfg *ioa_cfg,
 static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
        int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+       int rc;
 
        if (pcix_cmd_reg == 0)
                return 0;
 
-       if (pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-                                &ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+       rc = pci_read_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+                                 &ioa_cfg->saved_pcix_cmd_reg);
+       if (rc != PCIBIOS_SUCCESSFUL) {
                dev_err(&ioa_cfg->pdev->dev, "Failed to save PCI-X command register\n");
                return -EIO;
        }
@@ -785,10 +787,12 @@ static int ipr_save_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 static int ipr_set_pcix_cmd_reg(struct ipr_ioa_cfg *ioa_cfg)
 {
        int pcix_cmd_reg = pci_find_capability(ioa_cfg->pdev, PCI_CAP_ID_PCIX);
+       int rc;
 
        if (pcix_cmd_reg) {
-               if (pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
-                                         ioa_cfg->saved_pcix_cmd_reg) != PCIBIOS_SUCCESSFUL) {
+               rc = pci_write_config_word(ioa_cfg->pdev, pcix_cmd_reg + PCI_X_CMD,
+                                          ioa_cfg->saved_pcix_cmd_reg);
+               if (rc != PCIBIOS_SUCCESSFUL) {
                        dev_err(&ioa_cfg->pdev->dev, "Failed to setup PCI-X command register\n");
                        return -EIO;
                }