diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-02-24 14:58:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-08 14:40:25 +0200 |
commit | 7b59afe84ad916906beb0ec7eb04918260d1c552 (patch) | |
tree | 6f0e5e8c6f00e567b947714c9fb9f0cbc75ef695 /drivers/misc | |
parent | afcbc6375233d3b25cdf1bd60072df851b918bce (diff) | |
download | linux-stable-7b59afe84ad916906beb0ec7eb04918260d1c552.tar.gz linux-stable-7b59afe84ad916906beb0ec7eb04918260d1c552.tar.bz2 linux-stable-7b59afe84ad916906beb0ec7eb04918260d1c552.zip |
habanalabs: Add check for pci_enable_device
[ Upstream commit 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 ]
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@iscas.ac.cn>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/habanalabs/common/debugfs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/habanalabs/common/debugfs.c b/drivers/misc/habanalabs/common/debugfs.c index 912ddfa360b1..9716b0728b30 100644 --- a/drivers/misc/habanalabs/common/debugfs.c +++ b/drivers/misc/habanalabs/common/debugfs.c @@ -859,6 +859,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); |