ata: libata: make ata_host_suspend() *void*
authorSergey Shtylyov <s.shtylyov@omp.ru>
Wed, 2 Feb 2022 20:58:21 +0000 (23:58 +0300)
committerDamien Le Moal <damien.lemoal@opensource.wdc.com>
Sat, 19 Feb 2022 02:18:35 +0000 (11:18 +0900)
ata_host_suspend() always returns 0, so the result checks in many drivers
look pointless.  Let's make this function return *void* instead of *int*.

Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
16 files changed:
drivers/ata/ahci.c
drivers/ata/ata_piix.c
drivers/ata/libahci_platform.c
drivers/ata/libata-core.c
drivers/ata/pata_arasan_cf.c
drivers/ata/pata_cs5520.c
drivers/ata/pata_imx.c
drivers/ata/pata_macio.c
drivers/ata/pata_mpc52xx.c
drivers/ata/pata_samsung_cf.c
drivers/ata/pata_triflex.c
drivers/ata/sata_fsl.c
drivers/ata/sata_highbank.c
drivers/ata/sata_mv.c
drivers/ata/sata_rcar.c
include/linux/libata.h

index edca4e8fd44e6c713a54cef0f6bdd422b84e3150..51045fd052431e9f0928e1ff89e52893fb25c779 100644 (file)
@@ -891,7 +891,8 @@ static int ahci_pci_device_suspend(struct device *dev)
        }
 
        ahci_pci_disable_interrupts(host);
-       return ata_host_suspend(host, PMSG_SUSPEND);
+       ata_host_suspend(host, PMSG_SUSPEND);
+       return 0;
 }
 
 static int ahci_pci_device_resume(struct device *dev)
index 27b0d903f91f52dd87365fde4f9a343d4c1a91a6..ade5e894563b3c32421da0dcabbab422faa8cd6a 100644 (file)
@@ -993,11 +993,8 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
        struct ata_host *host = pci_get_drvdata(pdev);
        unsigned long flags;
-       int rc = 0;
 
-       rc = ata_host_suspend(host, mesg);
-       if (rc)
-               return rc;
+       ata_host_suspend(host, mesg);
 
        /* Some braindamaged ACPI suspend implementations expect the
         * controller to be awake on entry; otherwise, it burns cpu
index 18296443ccbacfb26e35313314a279396204bbd5..65227ef6b84648d6e12af9437c133116450e3db5 100644 (file)
@@ -733,7 +733,8 @@ int ahci_platform_suspend_host(struct device *dev)
        if (hpriv->flags & AHCI_HFLAG_SUSPEND_PHYS)
                ahci_platform_disable_phys(hpriv);
 
-       return ata_host_suspend(host, PMSG_SUSPEND);
+       ata_host_suspend(host, PMSG_SUSPEND);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(ahci_platform_suspend_host);
 
index 3ceda1fa243d1961ec525bd03e381780864386b5..0ddb49f2ece1618ef2058e24f185c4a348bcd798 100644 (file)
@@ -5170,10 +5170,9 @@ EXPORT_SYMBOL_GPL(ata_sas_port_resume);
  *
  *     Suspend @host.  Actual operation is performed by port suspend.
  */
-int ata_host_suspend(struct ata_host *host, pm_message_t mesg)
+void ata_host_suspend(struct ata_host *host, pm_message_t mesg)
 {
        host->dev->power.power_state = mesg;
-       return 0;
 }
 EXPORT_SYMBOL_GPL(ata_host_suspend);
 
@@ -6090,11 +6089,8 @@ EXPORT_SYMBOL_GPL(ata_pci_device_do_resume);
 int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
        struct ata_host *host = pci_get_drvdata(pdev);
-       int rc = 0;
 
-       rc = ata_host_suspend(host, mesg);
-       if (rc)
-               return rc;
+       ata_host_suspend(host, mesg);
 
        ata_pci_device_do_suspend(pdev, mesg);
 
index 24c3d5e1fca358fe1383e3cc9b64ee2e298d48f2..e89617ed9175b5f3afd94d8d4141e5c84447ac00 100644 (file)
@@ -937,7 +937,8 @@ static int arasan_cf_suspend(struct device *dev)
                dmaengine_terminate_all(acdev->dma_chan);
 
        cf_exit(acdev);
-       return ata_host_suspend(host, PMSG_SUSPEND);
+       ata_host_suspend(host, PMSG_SUSPEND);
+       return 0;
 }
 
 static int arasan_cf_resume(struct device *dev)
index 24ce8665b1f9189f6765b32431c3d350ada511cf..f4289a532f871561e2bc40bb274a627b48dbacc0 100644 (file)
@@ -259,11 +259,8 @@ static int cs5520_reinit_one(struct pci_dev *pdev)
 static int cs5520_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
        struct ata_host *host = pci_get_drvdata(pdev);
-       int rc = 0;
 
-       rc = ata_host_suspend(host, mesg);
-       if (rc)
-               return rc;
+       ata_host_suspend(host, mesg);
 
        pci_save_state(pdev);
        return 0;
index 2e538726802b68674f172a7c76e459f743ed5e91..150939275b1b9411df3a0068c66e0f9035f4330f 100644 (file)
@@ -223,17 +223,14 @@ static int pata_imx_suspend(struct device *dev)
 {
        struct ata_host *host = dev_get_drvdata(dev);
        struct pata_imx_priv *priv = host->private_data;
-       int ret;
 
-       ret = ata_host_suspend(host, PMSG_SUSPEND);
-       if (!ret) {
-               __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN);
-               priv->ata_ctl =
-                       __raw_readl(priv->host_regs + PATA_IMX_ATA_CONTROL);
-               clk_disable_unprepare(priv->clk);
-       }
+       ata_host_suspend(host, PMSG_SUSPEND);
 
-       return ret;
+       __raw_writel(0, priv->host_regs + PATA_IMX_ATA_INT_EN);
+       priv->ata_ctl = __raw_readl(priv->host_regs + PATA_IMX_ATA_CONTROL);
+       clk_disable_unprepare(priv->clk);
+
+       return 0;
 }
 
 static int pata_imx_resume(struct device *dev)
index 16e8aa184a75793f53302e561f7c477993e26fb3..3c3509f18cdd0aeec98da1dac3632f9c284fe880 100644 (file)
@@ -853,12 +853,8 @@ static int pata_macio_slave_config(struct scsi_device *sdev)
 #ifdef CONFIG_PM_SLEEP
 static int pata_macio_do_suspend(struct pata_macio_priv *priv, pm_message_t mesg)
 {
-       int rc;
-
        /* First, core libata suspend to do most of the work */
-       rc = ata_host_suspend(priv->host, mesg);
-       if (rc)
-               return rc;
+       ata_host_suspend(priv->host, mesg);
 
        /* Restore to default timings */
        pata_macio_default_timings(priv);
index f1d352d5f128537acbe861860e44dd2618a90158..c1b138d24b0539c1fb0912c9b77f3f371b3e0fe2 100644 (file)
@@ -824,7 +824,8 @@ mpc52xx_ata_suspend(struct platform_device *op, pm_message_t state)
 {
        struct ata_host *host = platform_get_drvdata(op);
 
-       return ata_host_suspend(host, state);
+       ata_host_suspend(host, state);
+       return 0;
 }
 
 static int
index 3da0e8e302861364b2bbbcab10236cad44974a32..377cd6bd87ac3d33d1d439ff7671be5b0e84f051 100644 (file)
@@ -608,7 +608,8 @@ static int pata_s3c_suspend(struct device *dev)
 {
        struct ata_host *host = dev_get_drvdata(dev);
 
-       return ata_host_suspend(host, PMSG_SUSPEND);
+       ata_host_suspend(host, PMSG_SUSPEND);
+       return 0;
 }
 
 static int pata_s3c_resume(struct device *dev)
index 8a033598e7e17519a8e18dfd0aaf6a6ebc465e08..782162d2f3f8f9009e2f8eab8d848b4b86c0fd45 100644 (file)
@@ -198,11 +198,8 @@ static const struct pci_device_id triflex[] = {
 static int triflex_ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
        struct ata_host *host = pci_get_drvdata(pdev);
-       int rc = 0;
 
-       rc = ata_host_suspend(host, mesg);
-       if (rc)
-               return rc;
+       ata_host_suspend(host, mesg);
 
        /*
         * We must not disable or powerdown the device.
index da0152116d9f779dd1447ab0452247d7540b407b..cfe93c420488b8b212e6efdf3a526e70adb5ea92 100644 (file)
@@ -1546,7 +1546,9 @@ static int sata_fsl_remove(struct platform_device *ofdev)
 static int sata_fsl_suspend(struct platform_device *op, pm_message_t state)
 {
        struct ata_host *host = platform_get_drvdata(op);
-       return ata_host_suspend(host, state);
+
+       ata_host_suspend(host, state);
+       return 0;
 }
 
 static int sata_fsl_resume(struct platform_device *op)
index b29d3f1d64b03317a681ae947bc78f2033c38ed9..077bce76c4459c3cc689cd3dfec6fe67ae46ba48 100644 (file)
@@ -587,7 +587,8 @@ static int ahci_highbank_suspend(struct device *dev)
        writel(ctl, mmio + HOST_CTL);
        readl(mmio + HOST_CTL); /* flush */
 
-       return ata_host_suspend(host, PMSG_SUSPEND);
+       ata_host_suspend(host, PMSG_SUSPEND);
+       return 0;
 }
 
 static int ahci_highbank_resume(struct device *dev)
index 53446b997740d5fdd5a7c15ca5d86aebc71900ed..3b2a0d228306349949f32e912b6c6fca123f03ed 100644 (file)
@@ -4235,10 +4235,10 @@ static int mv_platform_remove(struct platform_device *pdev)
 static int mv_platform_suspend(struct platform_device *pdev, pm_message_t state)
 {
        struct ata_host *host = platform_get_drvdata(pdev);
+
        if (host)
-               return ata_host_suspend(host, state);
-       else
-               return 0;
+               ata_host_suspend(host, state);
+       return 0;
 }
 
 static int mv_platform_resume(struct platform_device *pdev)
index 3d96b6faa3f0e1c64e409df1327906b50ae3a0a5..be8bfefed663fc35bfcee57162f2e7a6f3e5feec 100644 (file)
@@ -945,19 +945,17 @@ static int sata_rcar_suspend(struct device *dev)
        struct ata_host *host = dev_get_drvdata(dev);
        struct sata_rcar_priv *priv = host->private_data;
        void __iomem *base = priv->base;
-       int ret;
 
-       ret = ata_host_suspend(host, PMSG_SUSPEND);
-       if (!ret) {
-               /* disable interrupts */
-               iowrite32(0, base + ATAPI_INT_ENABLE_REG);
-               /* mask */
-               iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
+       ata_host_suspend(host, PMSG_SUSPEND);
 
-               pm_runtime_put(dev);
-       }
+       /* disable interrupts */
+       iowrite32(0, base + ATAPI_INT_ENABLE_REG);
+       /* mask */
+       iowrite32(priv->sataint_mask, base + SATAINTMASK_REG);
 
-       return ret;
+       pm_runtime_put(dev);
+
+       return 0;
 }
 
 static int sata_rcar_resume(struct device *dev)
index 605756f645bee8546c07489f8f86e922b77b7976..a49e75c4206d3eed17fdefb90b13e37d40acf44d 100644 (file)
@@ -1080,7 +1080,7 @@ extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
 extern bool ata_link_online(struct ata_link *link);
 extern bool ata_link_offline(struct ata_link *link);
 #ifdef CONFIG_PM
-extern int ata_host_suspend(struct ata_host *host, pm_message_t mesg);
+extern void ata_host_suspend(struct ata_host *host, pm_message_t mesg);
 extern void ata_host_resume(struct ata_host *host);
 extern void ata_sas_port_suspend(struct ata_port *ap);
 extern void ata_sas_port_resume(struct ata_port *ap);