Skip to content

Commit 65ea840

Browse files
Zheng Yongjunyilunxu1984
authored andcommitted
fpga: stratix10-soc: Fix return value check in s10_ops_write_init()
In case of error, the function stratix10_svc_allocate_memory() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: e7eef1d ("fpga: add intel stratix10 soc fpga manager driver") Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Reviewed-by: Russ Weight <russell.h.weight@intel.com> Cc: stable@vger.kernel.org Acked-by: Xu Yilun <yilun.xu@intel.com> Link: https://lore.kernel.org/r/20221126071430.19540-1-zhengyongjun3@huawei.com Signed-off-by: Xu Yilun <yilun.xu@intel.com>
1 parent 1b929c0 commit 65ea840

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/fpga/stratix10-soc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
213213
/* Allocate buffers from the service layer's pool. */
214214
for (i = 0; i < NUM_SVC_BUFS; i++) {
215215
kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE);
216-
if (!kbuf) {
216+
if (IS_ERR(kbuf)) {
217217
s10_free_buffers(mgr);
218-
ret = -ENOMEM;
218+
ret = PTR_ERR(kbuf);
219219
goto init_done;
220220
}
221221

0 commit comments

Comments
 (0)