Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2077929lqa; Tue, 30 Apr 2024 07:39:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIxWAzcgdSd/0Yk5ctJTQ3pi6R8csgvKcvL6mH6A+OenJy/4LkbUxmSpooEmlCTj25yh+V2b1IXHjyPzxPbyol8YRN1rHsq8/vtIh7RA== X-Google-Smtp-Source: AGHT+IFr9k+/4jRv8SyWhbPnGRJMKf72DCygc80ITDFcVql7X3L7NpVKOVob2iJUho0CXje1i2yG X-Received: by 2002:a05:6870:3510:b0:239:ba3d:39f1 with SMTP id k16-20020a056870351000b00239ba3d39f1mr16945580oah.2.1714487955585; Tue, 30 Apr 2024 07:39:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714487955; cv=pass; d=google.com; s=arc-20160816; b=MCNnK0swML2sgOsCb1gde5buHfIYuyqi39+UUxpNdXHNlHuYWIRJmu8DhjLy0yW6in 1oWnkVQSNNOHZkikNrfQcJgI1Dq0tnj8Wpj8tXPaDmx45im17u1hX1ddT85L1DXIr1y1 eGDhvQFvuMwb6pKSgxL4vQACSw/H6zk+7DVWjxE6pJP+MqRXPZ1jQxMoRf9vfGK//R61 YrI6KAeLZe4EquZk021S8VSDTGY4DfQ/NJLGjfaaxuO1JEbDQMaBmWDlCXU2/eb0J1ZC xXiEBED122sIlYdsuTc8lPX9311ioTF7bznUDaHGsmuIwxgIgpG5/eiIKBD349Lqhnow PfJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=9GfdhgAoi7qvvMzMfyxgMqwaztoKs0gOOY3vNndlHvI=; fh=25IklNjpQtm3+ZI4w1ifckV22BkO2b6a/wyTwiBBJrk=; b=F7Neccsy8wzmEqVGIHe7nxzItBWgCr/FSaAWzd7PL9V8fnnJDmWoRX0m7/i4C9Xeme 4GjwRL4TIFX61D2cOZMBIyJs/8zVk2tO3ozS7iipdYG6sKd52T1PgDAQtLybjVsq6SD7 YoX6hMv5Ayr9L/3bMQWL1JTOOhrvzDsXPhRojXchw4EO1ee2Bwn0/FEEbPBwBhSmK42A wPfGTeQ2Mmr6R4KgAHEtIGSp/x/ZHvZ0p6dbI5L14MStNIkH7gYU9edo98RA0N8HSS7u /AWvXWfe5mkhkw23b/U9oKpKqe2fery6vBsM8PWlwMf4Y4jll6cJRmLYm9ASeErUCeok nDOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-164137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g2-20020a631102000000b005c220a94525si21611839pgl.90.2024.04.30.07.39.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 07:39:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-164137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-164137-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-164137-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F1B242865A0 for ; Tue, 30 Apr 2024 14:31:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C41017BB04; Tue, 30 Apr 2024 14:26:43 +0000 (UTC) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3DE191527B9; Tue, 30 Apr 2024 14:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487202; cv=none; b=SVJX7BslTloeFAaMHZyzsGYW4PKpkWiPgM1J6wBo8M8pOalDCwXzl772LiTUgRZN4lUtrosuoON+tjcTWYE0yt5uqp2/M5gZDotYkmfYXZWwaGcEPH4VFgptW37jE3PPtM+2z/JHmn4znyAj5wLlhimN8DRTitISSNCjLQbWFmc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714487202; c=relaxed/simple; bh=++tTBu/3iosilBm8q623VgJey1KjvjPLHE3HQskF/j4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=UE1XS1vIa6VQXAg8Pmlcm9wPbDpZBlwwnF6mzV2NwmNgbLhGix2z8abDQqGU+JPcasJBT52wXEgepTrTbL8iUBISd4PQoacdFrdgr1ezpuK6A1kONIr2l1o+UpTenDs7XLqIjg3JVhG7s4tGnjPRr2MPV+UWvYalg5HWrhSI8os= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4VTMvK1bnTz6DB5S; Tue, 30 Apr 2024 22:26:21 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (unknown [7.191.163.240]) by mail.maildlp.com (Postfix) with ESMTPS id 47CF4140A08; Tue, 30 Apr 2024 22:26:39 +0800 (CST) Received: from SecurePC-101-06.china.huawei.com (10.122.247.231) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 30 Apr 2024 15:26:38 +0100 From: Jonathan Cameron To: Thomas Gleixner , Peter Zijlstra , , , , , , , , , Russell King , "Rafael J . Wysocki" , Miguel Luis , James Morse , Salil Mehta , Jean-Philippe Brucker , Catalin Marinas , Will Deacon , Marc Zyngier , Hanjun Guo , Gavin Shan CC: Ingo Molnar , Borislav Petkov , Dave Hansen , , , Subject: [PATCH v9 04/19] ACPI: processor: Return an error if acpi_processor_get_info() fails in processor_add() Date: Tue, 30 Apr 2024 15:24:19 +0100 Message-ID: <20240430142434.10471-5-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> References: <20240430142434.10471-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml100003.china.huawei.com (7.191.160.210) To lhrpeml500005.china.huawei.com (7.191.163.240) Rafael observed [1] that returning 0 from processor_add() will result in acpi_default_enumeration() being called which will attempt to create a platform device, but that makes little sense when the processor is known to be not available. So just return the error code from acpi_processor_get_info() instead. Link: https://lore.kernel.org/all/CAJZ5v0iKU8ra9jR+EmgxbuNm=Uwx2m1-8vn_RAZ+aCiUVLe3Pw@mail.gmail.com/ [1] Suggested-by: Rafael J. Wysocki Signed-off-by: Jonathan Cameron --- v9: New patch following through from Gavin pointing out a memory leak later in the series. --- drivers/acpi/acpi_processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c index 161c95c9d60a..5f062806ca40 100644 --- a/drivers/acpi/acpi_processor.c +++ b/drivers/acpi/acpi_processor.c @@ -393,7 +393,7 @@ static int acpi_processor_add(struct acpi_device *device, result = acpi_processor_get_info(device); if (result) /* Processor is not physically present or unavailable */ - return 0; + return result; BUG_ON(pr->id >= nr_cpu_ids); -- 2.39.2