You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
habanalabs: Add check for pci_enable_device
[ Upstream commit9c27896ac1] As the potential failure of the pci_enable_device(), it should be better to check the return value and return error if fails. Fixes:70b2f993ea("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
afcbc63752
commit
7b59afe84a
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user