Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp11836105rwb; Fri, 25 Nov 2022 23:38:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf6cnJ5sROqQiPRsPX56wjc7hTmXuSsBSjhcM9yKDZBM0OnFtN7YVqYt4eEE4i8vpfwLzZb/ X-Received: by 2002:a17:907:1dc6:b0:78d:8533:be13 with SMTP id og6-20020a1709071dc600b0078d8533be13mr35099652ejc.716.1669448309698; Fri, 25 Nov 2022 23:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669448309; cv=none; d=google.com; s=arc-20160816; b=eu8xSE565oWqAm/3HulRefp3ouyP+a29cGY4jIfyv09FsD6Rl0S6snn0UvEki/WCZD HmXEo9rBFezj+cYe3U5xafFymO+P9MkIBSmDxgHbhcvCU6GBsyZ84T/wU2DRJi+14kGb 6SPx9jHFi+UbtJJPoJDiL5621mbBBRkZl2N38P/QIRxhIu4/wXF924cIehBWiTpQd1Lg h54SoLb66Z2WggBDDD4Px5m4DsnTjDWGApOWB2ZXVCbZv4gYPCniBaVnFln3IMIfonIB YH6Jz2lUv8B9JFXjAQAN9DnLOp7IbC7hM0tzldaJY0/makVpvDmoXQIQl3m8q2QLS7cj +3Ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=sl5uTulZxfNXIMMKD38NRWkX01oQSWccCnUVIRMFb7M=; b=gZQ9+3Zql4Xwdqgzaf5a5yhAb3bCNWbifBeZ5rkQaSzJvwOLCaJwlVfqOe1T8OpZzP d9qrVx8VD0gvbS3fA9MsySiFbKxfkXH5/Jv+6O7TIFcWgFgXze73kR883Y0LekMNEzdZ z2W61z8BQuOrJMo/7DZZ930pw0txFBO5sNNgihET+/pj+tP7TbvN6D0yt5vSMDYYCZjB 0Gfddc2dDtWbO16v24hHowDnp0zBPRHPxYy7LcHvbXxzCplmeneTU0bYCmTVWIozQZZE /kc4ac73gtmYOJ1wd3hVlW3reIULweUEZQJPIOqQhhwaIsbtCwVtWVVZkB/+5SzPZYcV GD0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u9-20020aa7d0c9000000b00462772162bbsi5049326edo.423.2022.11.25.23.37.59; Fri, 25 Nov 2022 23:38:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230121AbiKZHQm (ORCPT + 85 others); Sat, 26 Nov 2022 02:16:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbiKZHQl (ORCPT ); Sat, 26 Nov 2022 02:16:41 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226D327DDE; Fri, 25 Nov 2022 23:16:39 -0800 (PST) Received: from kwepemi500013.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NK31F5gZSzRpTw; Sat, 26 Nov 2022 15:16:01 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500013.china.huawei.com (7.221.188.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Sat, 26 Nov 2022 15:16:35 +0800 From: Zheng Yongjun To: , , , , CC: Subject: [PATCH] fpga: stratix10-soc: Fix return value check in s10_ops_write_init() Date: Sat, 26 Nov 2022 07:14:30 +0000 Message-ID: <20221126071430.19540-1-zhengyongjun3@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500013.china.huawei.com (7.221.188.120) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: e7eef1d7633a ("fpga: add intel stratix10 soc fpga manager driver") Signed-off-by: Zheng Yongjun --- drivers/fpga/stratix10-soc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index 357cea58ec98..f7f01982a512 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c @@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpga_manager *mgr, /* Allocate buffers from the service layer's pool. */ for (i = 0; i < NUM_SVC_BUFS; i++) { kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE); - if (!kbuf) { + if (IS_ERR(kbuf)) { s10_free_buffers(mgr); - ret = -ENOMEM; + ret = PTR_ERR(kbuf); goto init_done; } -- 2.17.1