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 <[email protected]> Reviewed-by: Russ Weight <[email protected]> Cc: [email protected] Acked-by: Xu Yilun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Xu Yilun <[email protected]>
1 parent 1b929c0 commit 65ea840

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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)