Message ID | 20221115091138.51614-1-wupeng58@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2606756wru; Tue, 15 Nov 2022 01:20:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf50yurw50OoaAGxDvQI3/Y4kU222Lxq7UaJ2bmb3QX00OIZRl4ejpIxksO+0X+Mp5MUedsY X-Received: by 2002:a17:90a:8413:b0:217:dd3a:1ea5 with SMTP id j19-20020a17090a841300b00217dd3a1ea5mr1326446pjn.53.1668504008867; Tue, 15 Nov 2022 01:20:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668504008; cv=none; d=google.com; s=arc-20160816; b=Hd78izybPQIA8D7Hg6Hnp16qWeBDmoq+WBVgsNNXXo0dHtijB27gLf7EHCa0RBq1cp GHqw85XIrGfBwJnYRlhsW1L9vPFval6TLkYdaGoY/QjhNIDT3KJz0m/k6qx86Kh9a9yk hyxJkkO4s2ZoirQuzvr3TijGVJKIIiTDD6EumvNVDSVk+MlItMejrg9dpeB9THc38z97 WH/mSQxox3Vaks0J+gteFCRNSMZVEAzAmVqheM2NEpelFLgi7rbnfIpad76ThS81wjFy un7MdFQtLwNWKVWDdr5MTQppWCmslXP2n1ThvGfZ74JSiKWudNAcUInvy2xJ0opXfyPc O8UA== 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=XXRZ+VzeH5MLQMTc+nRTYU6Nr52qR/fdsx9hh2gBcXg=; b=fznGovlqb6wtJzFAAkjwpYjvOV5zAQWYs7g+K8zhaCcBCND4ovUJQbICsjTg2FJJIY jojl5XlzLzspD1wEgv61U9uaPKiywRbVHxnrsSEhrmjoah48Pfjf1U5ZOUdRYpLzhvnf vWFZgE79qyZk1C5zKVD8bkw2yh9Fy9umo7x5VSuqva/TVaDgCVKuUedtZ/hbHWaABGES SNmDZCuZ6jsz6a9LA2o4RjPwPyXytZfSfU6BjccLc12cGxz+JM3IT8PfWs9m5lFgUP69 aa0AM4mZjEBR69RHuXokKwAptOsXONCtRyFeqhTOwURJws3scOr0uHZzVeZyQwIR0O4k 2mcA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a632c0c000000b00476ba5e977bsi1124596pgs.327.2022.11.15.01.19.54; Tue, 15 Nov 2022 01:20:08 -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 S237921AbiKOJOD (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Tue, 15 Nov 2022 04:14:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237915AbiKOJOB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 15 Nov 2022 04:14:01 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 713466401 for <linux-kernel@vger.kernel.org>; Tue, 15 Nov 2022 01:13:58 -0800 (PST) Received: from kwepemi500023.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NBL416H79zqSPZ; Tue, 15 Nov 2022 17:10:09 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500023.china.huawei.com (7.221.188.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 15 Nov 2022 17:13:25 +0800 From: Peng Wu <wupeng58@huawei.com> To: <jwerner@chromium.org>, <jrosenth@chromium.org>, <gregkh@linuxfoundation.org>, <groeck@chromium.org> CC: <linux-kernel@vger.kernel.org>, <liwei391@huawei.com>, Peng Wu <wupeng58@huawei.com> Subject: [PATCH -next] firmware: google: fix a NULL vs IS_ERR() check in cbmem_entry_probe() Date: Tue, 15 Nov 2022 09:11:38 +0000 Message-ID: <20221115091138.51614-1-wupeng58@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: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemi500023.china.huawei.com (7.221.188.76) 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749553259507503681?= X-GMAIL-MSGID: =?utf-8?q?1749553259507503681?= |
Series |
[-next] firmware: google: fix a NULL vs IS_ERR() check in cbmem_entry_probe()
|
|
Commit Message
Peng Wu
Nov. 15, 2022, 9:11 a.m. UTC
The devm_memremap() function returns error pointers on error,
it doesn't return NULL.
Fixes: 19d54020883c ("firmware: google: Implement cbmem in sysfs driver")
Signed-off-by: Peng Wu <wupeng58@huawei.com>
---
drivers/firmware/google/cbmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Tue, Nov 15, 2022 at 1:14 AM Peng Wu <wupeng58@huawei.com> wrote: > > The devm_memremap() function returns error pointers on error, > it doesn't return NULL. > > Fixes: 19d54020883c ("firmware: google: Implement cbmem in sysfs driver") > Signed-off-by: Peng Wu <wupeng58@huawei.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> > --- > drivers/firmware/google/cbmem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c > index 685f3070ce9d..88e587ba1e0d 100644 > --- a/drivers/firmware/google/cbmem.c > +++ b/drivers/firmware/google/cbmem.c > @@ -106,8 +106,8 @@ static int cbmem_entry_probe(struct coreboot_device *dev) > entry->mem_file_buf = devm_memremap(&dev->dev, dev->cbmem_entry.address, > dev->cbmem_entry.entry_size, > MEMREMAP_WB); > - if (!entry->mem_file_buf) > - return -ENOMEM; > + if (IS_ERR(entry->mem_file_buf)) > + return PTR_ERR(entry->mem_file_buf); > > entry->size = dev->cbmem_entry.entry_size; > > -- > 2.17.1 >
On 2022-11-15 at 09:11 +0000, Peng Wu wrote: > The devm_memremap() function returns error pointers on error, > it doesn't return NULL. > > Fixes: 19d54020883c ("firmware: google: Implement cbmem in sysfs driver") > Signed-off-by: Peng Wu <wupeng58@huawei.com> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> > --- > drivers/firmware/google/cbmem.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c > index 685f3070ce9d..88e587ba1e0d 100644 > --- a/drivers/firmware/google/cbmem.c > +++ b/drivers/firmware/google/cbmem.c > @@ -106,8 +106,8 @@ static int cbmem_entry_probe(struct coreboot_device *dev) > entry->mem_file_buf = devm_memremap(&dev->dev, dev->cbmem_entry.address, > dev->cbmem_entry.entry_size, > MEMREMAP_WB); > - if (!entry->mem_file_buf) > - return -ENOMEM; > + if (IS_ERR(entry->mem_file_buf)) > + return PTR_ERR(entry->mem_file_buf); > > entry->size = dev->cbmem_entry.entry_size; > > -- > 2.17.1 >
diff --git a/drivers/firmware/google/cbmem.c b/drivers/firmware/google/cbmem.c index 685f3070ce9d..88e587ba1e0d 100644 --- a/drivers/firmware/google/cbmem.c +++ b/drivers/firmware/google/cbmem.c @@ -106,8 +106,8 @@ static int cbmem_entry_probe(struct coreboot_device *dev) entry->mem_file_buf = devm_memremap(&dev->dev, dev->cbmem_entry.address, dev->cbmem_entry.entry_size, MEMREMAP_WB); - if (!entry->mem_file_buf) - return -ENOMEM; + if (IS_ERR(entry->mem_file_buf)) + return PTR_ERR(entry->mem_file_buf); entry->size = dev->cbmem_entry.entry_size;