]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/5.15.93/fpga-stratix10-soc-fix-return-value-check-in-s10_ops_write_init.patch
6.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 5.15.93 / fpga-stratix10-soc-fix-return-value-check-in-s10_ops_write_init.patch
CommitLineData
c65b8b30
GKH
1From 65ea840afd508194b0ee903256162aa87e46ec30 Mon Sep 17 00:00:00 2001
2From: Zheng Yongjun <zhengyongjun3@huawei.com>
3Date: Sat, 26 Nov 2022 07:14:30 +0000
4Subject: fpga: stratix10-soc: Fix return value check in s10_ops_write_init()
5
6From: Zheng Yongjun <zhengyongjun3@huawei.com>
7
8commit 65ea840afd508194b0ee903256162aa87e46ec30 upstream.
9
10In case of error, the function stratix10_svc_allocate_memory()
11returns ERR_PTR() and never returns NULL. The NULL test in the
12return value check should be replaced with IS_ERR().
13
14Fixes: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver")
15Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
16Reviewed-by: Russ Weight <russell.h.weight@intel.com>
17Cc: stable@vger.kernel.org
18Acked-by: Xu Yilun <yilun.xu@intel.com>
19Link: https://lore.kernel.org/r/20221126071430.19540-1-zhengyongjun3@huawei.com
20Signed-off-by: Xu Yilun <yilun.xu@intel.com>
21Signed-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