]>
Commit | Line | Data |
---|---|---|
c65b8b30 GKH |
1 | From 65ea840afd508194b0ee903256162aa87e46ec30 Mon Sep 17 00:00:00 2001 |
2 | From: Zheng Yongjun <zhengyongjun3@huawei.com> | |
3 | Date: Sat, 26 Nov 2022 07:14:30 +0000 | |
4 | Subject: fpga: stratix10-soc: Fix return value check in s10_ops_write_init() | |
5 | ||
6 | From: Zheng Yongjun <zhengyongjun3@huawei.com> | |
7 | ||
8 | commit 65ea840afd508194b0ee903256162aa87e46ec30 upstream. | |
9 | ||
10 | In case of error, the function stratix10_svc_allocate_memory() | |
11 | returns ERR_PTR() and never returns NULL. The NULL test in the | |
12 | return value check should be replaced with IS_ERR(). | |
13 | ||
14 | Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver") | |
15 | Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> | |
16 | Reviewed-by: Russ Weight <russell.h.weight@intel.com> | |
17 | Cc: stable@vger.kernel.org | |
18 | Acked-by: Xu Yilun <yilun.xu@intel.com> | |
19 | Link: https://lore.kernel.org/r/20221126071430.19540-1-zhengyongjun3@huawei.com | |
20 | Signed-off-by: Xu Yilun <yilun.xu@intel.com> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | --- | |
23 | drivers/fpga/stratix10-soc.c | 4 ++-- | |
24 | 1 file changed, 2 insertions(+), 2 deletions(-) | |
25 | ||
26 | --- a/drivers/fpga/stratix10-soc.c | |
27 | +++ b/drivers/fpga/stratix10-soc.c | |
28 | @@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpg | |
29 | /* Allocate buffers from the service layer's pool. */ | |
30 | for (i = 0; i < NUM_SVC_BUFS; i++) { | |
31 | kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE); | |
32 | - if (!kbuf) { | |
33 | + if (IS_ERR(kbuf)) { | |
34 | s10_free_buffers(mgr); | |
35 | - ret = -ENOMEM; | |
36 | + ret = PTR_ERR(kbuf); | |
37 | goto init_done; | |
38 | } | |
39 |