Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2061485ybg; Fri, 5 Jun 2020 04:45:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjUdce00QBiW9kCa7JXokk1NHNv7Wn5mJRGd7mpmW5ZGyhZj0PPKixfwTJbt6TTVKa7tAV X-Received: by 2002:a50:8d07:: with SMTP id s7mr9025180eds.371.1591357525697; Fri, 05 Jun 2020 04:45:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591357525; cv=none; d=google.com; s=arc-20160816; b=wF8HqTMXTMndWTiqI5R3dbVuq9Qd4UPB3o+jJPZ7ONpm1fvIm7n5x3DAKWfcYAm0Ad flXpAcLDr+01E1MH96vdpr/03ARMN8kbsG4qDq6T9uEhZuhRuaapmr8iUjLyG2Dx/mCd 7vt4jOl3nxrdaUQOCUY1nqKMA3u9wvY02yJlZGfc1InzCXnzVCiNebKCqax0nVOcNByt LRBIHJk33TKnlCknJtbTOOd07vNCXVxyT3zIJ59oEdbD6VDZgbaDaN3gd0FuwU/e96Gj os7DNLaFYlR45yLD5PT/neYxhfcs3ieQoUALc3nnJskQCzarS619YaveAMSKqFg14AZ8 JRsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:to :from; bh=2halfm+ACc4u4fe1fm4hF55aiGMnrAljnA+vZgNRWQA=; b=BJoaEyFmuiU7N/I6Au3V03J38gro2b3bwsMM3dmc/NwhFmCkaqQkAiPywbUrbIPS2n Es8Iu6dPvXoCqDqtXWprKN4j611grnwWXm3eIOenpYhzpZClQU6P0wt0hVCv//SmaSIk xSzznUYgBaiWNHJ6CGIGteNoMsHw6QCBbMaKXwIXAPpMmaRPpaRMtMo1i31HKoJjEiOs wNSyAYbxE8FTd2gx5U4kXdoVzZSEzqyyTbNtCW8692yGfZ8ZN5yM8a5hVjcYaOVDFk/h JZDNqWg3fjND49a+NO4VakEJgrSTaoND/220oe4AZrQbDSJ78jR+ck1g7liooDibeYYI 29VQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p4si3308575edd.374.2020.06.05.04.45.02; Fri, 05 Jun 2020 04:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726371AbgFELl6 (ORCPT + 99 others); Fri, 5 Jun 2020 07:41:58 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5857 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726303AbgFELl6 (ORCPT ); Fri, 5 Jun 2020 07:41:58 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5CE176CFE06CEB526169; Fri, 5 Jun 2020 19:41:54 +0800 (CST) Received: from huawei.com (10.175.104.57) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Fri, 5 Jun 2020 19:41:50 +0800 From: Lu Wei To: , , , , , Subject: [PATCH v2] ACPI / platform: Fix return value check in check_acpi_dev() Date: Fri, 5 Jun 2020 19:38:14 +0800 Message-ID: <1591357094-39850-1-git-send-email-luwei32@huawei.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.104.57] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In the function check_acpi_dev(), if it fails to create platform device, the return value is ERR_PTR() or NULL. Thus it must use IS_ERR_OR_NULL to check return value. Fixes: ecc83e52b28c (intel-hid: new hid event driver for hotkeys) Reported-by: Hulk Robot Signed-off-by: Lu Wei --- v1->v2 - Modify commit message drivers/platform/x86/intel-hid.c | 2 +- drivers/platform/x86/intel-vbtn.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/intel-hid.c b/drivers/platform/x86/intel-hid.c index cc7dd4d..c45250c 100644 --- a/drivers/platform/x86/intel-hid.c +++ b/drivers/platform/x86/intel-hid.c @@ -564,7 +564,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) return AE_OK; if (acpi_match_device_ids(dev, ids) == 0) - if (acpi_create_platform_device(dev, NULL)) + if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) dev_info(&dev->dev, "intel-hid: created platform device\n"); diff --git a/drivers/platform/x86/intel-vbtn.c b/drivers/platform/x86/intel-vbtn.c index b588093..e1aa526 100644 --- a/drivers/platform/x86/intel-vbtn.c +++ b/drivers/platform/x86/intel-vbtn.c @@ -251,7 +251,7 @@ check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) return AE_OK; if (acpi_match_device_ids(dev, ids) == 0) - if (acpi_create_platform_device(dev, NULL)) + if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) dev_info(&dev->dev, "intel-vbtn: created platform device\n"); -- 2.7.4