Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2869631iob; Mon, 16 May 2022 07:59:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLYYhI13eGXdMFm18Kx+GFOiZQRXJMgz1JsW52UuUeSPXQYlZvE63+rvGUX32T2YzlbKNk X-Received: by 2002:a17:907:16a8:b0:6f3:e9fc:29e7 with SMTP id hc40-20020a17090716a800b006f3e9fc29e7mr15642290ejc.428.1652713164282; Mon, 16 May 2022 07:59:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652713164; cv=none; d=google.com; s=arc-20160816; b=TCFrXLvVwkaLBCTAWW4fDc/XqPpR+CGmPNVwSxWG/UBlt8lh0bZj5jtQFWYaFc4Tdt XOia6lsPkROrvzGaBHMc+098fAfVrpoiS3NFPVzHjMDRWx4ScK4b1Sc46FM+tYlJmlV8 3Njf5b1AIWft7ux0l+GMFbAmYM3fdJxVWlQ9eywy+iWgZ5Um3VAOLUayZVCPSViBEGnD jcmRVAbkbBaa6zNaO1/OW+47WT5ZAHBRv/LpwR9WKH9nytZVReujEEsfUy5YsmOsrxEk pjHGR6ijCnwTj8hNtiPrxaxMR+cfkuf2duyGff/HsQ4v1VCUGDFteK3kD8PiWMYXXmna PJcA== 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; bh=vhh6ifJ/C6YzyfKn4OwXJkkZf+Bn5hISurSNqM0m4Pk=; b=R9tsMXZJFesQ85mZQk3aJ6DGcCYwKCX0O2+d1OjwXUm8938emfui4ZbumWMsFHoGk4 qi3SmKcmuskq4plOOAwreBX2dK+tlvPTRIlIyawDGaqMeNKoPHiYUyk4upK32XqgVxjC hM1By/JvRLzRVHVXwczeuL0NL7s8bu8rL77gpw1iQq8Cxl4DDwpJyR1GjoRMeA9+rbb5 4Ghl9AyJwNG3NgDQ4dTt+6HpH/dxjRsHjY76yw5FurACmTsorDLvo2aSpIjwympoCpQt wJWsVfkwYwW6KjrNYAebjBqv5BeSGmrNVg5YaB3QZ4qFjJmAjWbQNS4Y6e5l1Q0iksPd 83uQ== 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 p6-20020a056402044600b00425ed30f8fdsi8946358edw.234.2022.05.16.07.58.58; Mon, 16 May 2022 07:59:24 -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; 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 S233265AbiEPNEM (ORCPT + 99 others); Mon, 16 May 2022 09:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233172AbiEPNEJ (ORCPT ); Mon, 16 May 2022 09:04:09 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 825CA39B8B; Mon, 16 May 2022 06:04:07 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4L1zs45YMrzGq0p; Mon, 16 May 2022 21:01:12 +0800 (CST) Received: from dggpemm500007.china.huawei.com (7.185.36.183) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 16 May 2022 21:04:05 +0800 Received: from huawei.com (10.175.103.91) by dggpemm500007.china.huawei.com (7.185.36.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 16 May 2022 21:04:05 +0800 From: Yang Yingliang To: , CC: , Subject: [PATCH -next] usb: typec: ucsi: fix return value check in ucsi_acpi_probe() Date: Mon, 16 May 2022 21:15:27 +0800 Message-ID: <20220516131527.999909-1-yangyingliang@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500007.china.huawei.com (7.185.36.183) 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,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 If memremap() fails, it never returns NULL. Replace NULL check with IS_ERR(). Fixes: cdc3d2abf438 ("usb: typec: ucsi: acpi: Map the mailbox with memremap()") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang --- drivers/usb/typec/ucsi/ucsi_acpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c index 7455e3aff2be..8873c1644a29 100644 --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -133,8 +133,8 @@ static int ucsi_acpi_probe(struct platform_device *pdev) } ua->base = devm_memremap(&pdev->dev, res->start, resource_size(res), MEMREMAP_WB); - if (!ua->base) - return -ENOMEM; + if (IS_ERR(ua->base)) + return PTR_ERR(ua->base); ret = guid_parse(UCSI_DSM_UUID, &ua->guid); if (ret) -- 2.25.1