From patchwork Thu Jul 27 19:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 127153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:d09a:b0:134:c3fc:3153 with SMTP id jc26csp181703rwb; Thu, 27 Jul 2023 13:31:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlFPCRTAJDB3+dNMogeDIkRch+5ijQSIUN8UfvpXcEfOBu+popifNr4wzNl2nTaQHaAkYDgZ X-Received: by 2002:aa7:d352:0:b0:522:289d:8dd3 with SMTP id m18-20020aa7d352000000b00522289d8dd3mr61247edr.29.1690489901914; Thu, 27 Jul 2023 13:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690489901; cv=none; d=google.com; s=arc-20160816; b=hMIHLU9sDfS0tONl9wAh970+YktIEDbhLEi+s+p6kdd1E5keeGyVapnAfDAnLA6+Vb jfgygslwQfgKRqettwVhqmDn/Eyc99aTfa8aV2iLHkY3Jzr2WZuSDuuVeJ5EKa7LlQQu DeSx5WFUa1LcnrizofuEHxXTi5ORaasBUyaGiKoTMIENyw9ca98NszpWNXATz9Q9cY72 hawfp2awhVs9v276M/bytR9LDlfc67wXvKo3e9OvxfOHWPRnjSmGlYUa71kXaCYkPmkZ dKO+d8Vsoxm9saY/E2zDJNxhC3753TcTfjeZmt/FLLFbGU8ajLHK/tr2isnuWPeeDmz8 sfOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=k2DhPmmlaQqBpIoT+mXgbTQH2ZIfYd+eKTTrRlKRVh0=; fh=9Io8eHEr+n9QL7aOTkBmN24K0npC2qRIKqnoDkb0Y7E=; b=QgTE+QIvpfWOqEaSnd4b1J8uaNfB/T5CpnlNH5fFU85HXi5oKt7QTHxaCX2y8WgtiB GYt8zGE3IdEkwSOlmXcPPSCXUR5lKXvebGJ8XJ1hgrGK2frGaQUXg7dSDN94qVv7gt50 ql7NAw5+tuM2CKb0fQ59Tg6zFqcEHspTXvIpR487K0Ej3cGISX1VMiaiGO7QXa7zmcTL aSQquiPK+2T+7APBFy03ygtuqGx3fGscZHsjLkVz7gRek28/obEoBOXkfyWOHV/JE5nW XRHkJ0Kma6NB9QIvc61xnbHGz3xkfodNpHM7SdVMhaqu2JLUpafMChp6xAR4ki78O8ei H6vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lA5tu1Z7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020aa7d614000000b00522472b99f5si1424707edr.285.2023.07.27.13.31.17; Thu, 27 Jul 2023 13:31:41 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lA5tu1Z7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230340AbjG0TiH (ORCPT + 99 others); Thu, 27 Jul 2023 15:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231925AbjG0TiC (ORCPT ); Thu, 27 Jul 2023 15:38:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F50D273C; Thu, 27 Jul 2023 12:38:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C9AB61F20; Thu, 27 Jul 2023 19:37:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02196C433C7; Thu, 27 Jul 2023 19:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690486678; bh=rE/Kd3G9NMSVIw3ayakgITZdDQaqNiUsnvItueTbY+w=; h=From:To:Cc:Subject:Date:From; b=lA5tu1Z7RaFa+Ys40DjEvhe665WRDbIAM9b7Gx3bm4GJNDILpMmqUQr/By4OSQS7Z vXNRun/zuYbeTr9GnTfJO0sAIc+MESL7JK8eLY83qxn+8GaUbNuiBoN8jxJIMkQWWz DqVOxaa9KnOvnvB+l1Nbo6HRg5e0eFDeth3V9uar9RUoFP8uTLdsaGLIjn63NSkgiZ xJQ6UkKTEaVLlyorUxWZZb535Di6/Vsf7drbFzOJCRt/61QpG0VFanIT3yjb7U5ZE2 vWMR3S5zc7OISTYYEsN6LN1mEpCsOc53ZoKUyFHwdNiS1nz7Ksq4twktFm/6wLGWVN VVbXS0zzC8ecg== From: Dinh Nguyen To: gregkh@linuxfoundation.org Cc: dinguyen@kernel.org, linux-kernel@vger.kernel.org, Wang Ming , stable@vger.kernel.org Subject: [PATCH] firmware: Fix an NULL vs IS_ERR() bug in probe Date: Thu, 27 Jul 2023 14:37:50 -0500 Message-Id: <20230727193750.983795-1-dinguyen@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772607139317965703 X-GMAIL-MSGID: 1772607139317965703 From: Wang Ming The devm_memremap() function returns error pointers. It never returns NULL. Fix the check. Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver") Cc: stable@vger.kernel.org Signed-off-by: Wang Ming Signed-off-by: Dinh Nguyen --- drivers/firmware/stratix10-svc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c index 260695a8a9e6..c693da60e9a9 100644 --- a/drivers/firmware/stratix10-svc.c +++ b/drivers/firmware/stratix10-svc.c @@ -774,7 +774,7 @@ svc_create_memory_pool(struct platform_device *pdev, paddr = begin; size = end - begin; va = devm_memremap(dev, paddr, size, MEMREMAP_WC); - if (!va) { + if (IS_ERR(va)) { dev_err(dev, "fail to remap shared memory\n"); return ERR_PTR(-EINVAL); }