[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211208192449.146076-2-helgaas@kernel.org>
Date: Wed, 8 Dec 2021 13:24:46 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: Jens Axboe <axboe@...nel.dk>,
Joshua Morris <josh.h.morris@...ibm.com>,
Philip Kelleher <pjk1939@...ux.ibm.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>,
Vaibhav Gupta <vaibhav.varodek@...il.com>,
Vaibhav Gupta <vaibhavgupta40@...il.com>,
linux-block@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Shuah Khan <skhan@...uxfoundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>
Subject: [PATCH v5 1/4] mtip32xx: remove pointless drvdata checking
From: Bjorn Helgaas <bhelgaas@...gle.com>
The .suspend() and .resume() methods are only called after the .probe()
method (mtip_pci_probe()) has set the drvdata and returned success.
Therefore, if we get to mtip_pci_suspend() or mtip_pci_resume(), the
drvdata must be valid. Drop the unnecessary checking.
Signed-off-by: Bjorn Helgaas <bhelgaas@...gle.com>
---
drivers/block/mtip32xx/mtip32xx.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index c91b9010c1a6..8677ac4c3431 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -4150,12 +4150,6 @@ static int mtip_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
int rv = 0;
struct driver_data *dd = pci_get_drvdata(pdev);
- if (!dd) {
- dev_err(&pdev->dev,
- "Driver private datastructure is NULL\n");
- return -EFAULT;
- }
-
set_bit(MTIP_DDF_RESUME_BIT, &dd->dd_flag);
/* Disable ports & interrupts then send standby immediate */
@@ -4189,14 +4183,7 @@ static int mtip_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
static int mtip_pci_resume(struct pci_dev *pdev)
{
int rv = 0;
- struct driver_data *dd;
-
- dd = pci_get_drvdata(pdev);
- if (!dd) {
- dev_err(&pdev->dev,
- "Driver private datastructure is NULL\n");
- return -EFAULT;
- }
+ struct driver_data *dd = pci_get_drvdata(pdev);
/* Move the device to active State */
pci_set_power_state(pdev, PCI_D0);
--
2.25.1
Powered by blists - more mailing lists