[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220224065805.3305407-1-jiasheng@iscas.ac.cn>
Date: Thu, 24 Feb 2022 14:58:05 +0800
From: Jiasheng Jiang <jiasheng@...as.ac.cn>
To: ogabbay@...nel.org, arnd@...db.de, gregkh@...uxfoundation.org,
ynudelman@...ana.ai, obitton@...ana.ai
Cc: linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] habanalabs: Add check for pci_enable_device
As the potential failure of the pci_enable_device(),
it should be better to check the return value and return
error if fails.
Fixes: 70b2f993ea4a ("habanalabs: create common folder")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
drivers/misc/habanalabs/common/debugfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c
index fc084ee5106e..09001fd9db85 100644
--- a/drivers/misc/habanalabs/common/debugfs.c
+++ b/drivers/misc/habanalabs/common/debugfs.c
@@ -890,6 +890,8 @@ static ssize_t hl_set_power_state(struct file *f, const char __user *buf,
pci_set_power_state(hdev->pdev, PCI_D0);
pci_restore_state(hdev->pdev);
rc = pci_enable_device(hdev->pdev);
+ if (rc < 0)
+ return rc;
} else if (value == 2) {
pci_save_state(hdev->pdev);
pci_disable_device(hdev->pdev);
--
2.25.1
Powered by blists - more mailing lists