* [PATCH] habanalabs: Add check for pci_enable_device
@ 2022-02-24 6:58 Jiasheng Jiang
2022-02-27 9:41 ` Oded Gabbay
0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2022-02-24 6:58 UTC (permalink / raw)
To: ogabbay, arnd, gregkh, ynudelman, obitton; +Cc: linux-kernel, Jiasheng Jiang
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>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] habanalabs: Add check for pci_enable_device
2022-02-24 6:58 [PATCH] habanalabs: Add check for pci_enable_device Jiasheng Jiang
@ 2022-02-27 9:41 ` Oded Gabbay
0 siblings, 0 replies; 2+ messages in thread
From: Oded Gabbay @ 2022-02-27 9:41 UTC (permalink / raw)
To: Jiasheng Jiang
Cc: Arnd Bergmann, Greg Kroah-Hartman, Yuri Nudelman, Ofir Bitton,
Linux-Kernel@Vger. Kernel. Org
On Thu, Feb 24, 2022 at 8:58 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote:
>
> 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>
> ---
> 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
>
This patch is:
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Applied to -next.
Thanks,
Oded
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-27 9:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 6:58 [PATCH] habanalabs: Add check for pci_enable_device Jiasheng Jiang
2022-02-27 9:41 ` Oded Gabbay
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.