diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-02-24 14:58:05 +0800 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2022-02-28 14:22:06 +0200 |
commit | 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 (patch) | |
tree | 07bc4050d0d6a6dd7e9a53a5a9cbb358100b28dd | |
parent | a78b07dcae2f9d6fafadb05540d8152f575d7e59 (diff) | |
download | linux-stable-9c27896ac1bb83ea5c461ce6f7089d02102a2b21.tar.gz linux-stable-9c27896ac1bb83ea5c461ce6f7089d02102a2b21.tar.bz2 linux-stable-9c27896ac1bb83ea5c461ce6f7089d02102a2b21.zip |
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@iscas.ac.cn>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
-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 9f0aaf0ef43b..f18495545854 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); |