From patchwork Fri Oct 20 21:10:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 156328 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp1326404vqb; Fri, 20 Oct 2023 14:10:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFwCMejWsxwwaa/BHP8Sf7yqGi252f3Xk3tx7GYQ1NZs+tNKolPaO6bzjtHYH6+aYeOFK6c X-Received: by 2002:a05:6a20:daa0:b0:17b:8404:96d5 with SMTP id iy32-20020a056a20daa000b0017b840496d5mr4073862pzb.21.1697836254144; Fri, 20 Oct 2023 14:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697836254; cv=none; d=google.com; s=arc-20160816; b=qzt6YYJxwnByd8L2duAWpDAA6Rgk0fAPJt36KSpZBARQgo3tTFruyTAeAs+OsvyNFg zl46vU+up25CygUAwQ6o/U6V2YabDeiBc7cSwb5AeW96SR9mgrH7LaZcl+5/PYY/nrTb oXtCzYXmd+jbXBkwEgC2is0Z3QYEdCwMwO9uHvLUfPNB7ApV2kz8xGn3ptu8nPM6NeZw IXZ8Hz7i07cK09KWiWYR6B8l25lFedJfDaLPpK2WGxbT9N/g9ngZiQ0XRtWt4+zG9lxf KMG0SN0PVsi6awyuYT6foXQPRVsHaYqm3TTKVCZrq/99eSmGy20kigzc4VNavznJkGUl ui9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9Ook8IfyQoydJxFII3cfCezwFTXYvOl5pC/HrusLMZ0=; fh=mlGq6PayYEZsp/+lQoaQb08ZaGzsJscMQg2+wc8B3Uo=; b=wn7394t/5huk3JS6KV0zU0+lLfhYhbd5gbn4eDKRXV0M1bHqoEg7sI/MLkUq4/zW2y mJ+IHBPU36gzKDRufEcf4G8L1OpCZzgISO/I6cdx29MD6Pjq3a9GvratUYAskuWc0wPY 6ko9iJAFnQEJnChjBq0qgf42zjqevLFjmrO/YotNfkBCZW2fsWCeaBHPZ82Q/J2Viy9R JKpsjYWRXDBTtvZgSMfAMtZNg5hysM+I0lpf2VeynIEQUcJgAE3jvNHVaJxHtNfw+cq+ fmaSYqw5HUtiLbu9Z8G1oMOX93lIP5bK2BXUzL7UrFOypXF5ZlxAB3GneYlcVpQwMmNR rxuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="Eh/dJbbs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id x21-20020aa79575000000b006b4319c78efsi2602136pfq.389.2023.10.20.14.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 14:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b="Eh/dJbbs"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id D89F6830D125; Fri, 20 Oct 2023 14:10:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232850AbjJTVKj (ORCPT + 26 others); Fri, 20 Oct 2023 17:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230318AbjJTVK1 (ORCPT ); Fri, 20 Oct 2023 17:10:27 -0400 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBA4FD68; Fri, 20 Oct 2023 14:10:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1697836213; x=1698441013; i=w_armin@gmx.de; bh=mQwZ7HovL0XAV0BMMBNTr9Ft336d/JL1LOfzD0c2oJs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=Eh/dJbbsnRvIaOb/QLKYI3GmINne3a2xuiYHq0DnFEeiRyeVXFKSVIH5KFTL36NL YhCkhm4rb9bpQKtdF4VhUw1u4xfoJHS61lIpHA4LhdXdifi4zLhBBrx5GQAEZKZxJ 3i/TNQjYfYrfWgkOZLRIY9vPLNqhxL/zLKnwmui4TwgE8b6gamhjPjSR1NxEz1Az3 QNNpDYZVucwLuOk0RjHFPuhZ0I07uHPsh0ZK3k79EhOKgGFyY3K6hFok0xalXCbc9 Vd9xuzZsanyFIXCXmLSk25A07/CpbaFfgB2JzyXvOpP6wvKSNB46L54z3KHcC9G+O irYXG4blPWRoojIkoA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from mx-amd-b650.users.agdsn.de ([141.30.226.129]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MCbEf-1qkqCl3eN9-009exu; Fri, 20 Oct 2023 23:10:12 +0200 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, markgross@kernel.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] platform/x86: wmi: Fix probe failure when failing to register WMI devices Date: Fri, 20 Oct 2023 23:10:03 +0200 Message-Id: <20231020211005.38216-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231020211005.38216-1-W_Armin@gmx.de> References: <20231020211005.38216-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:K8Pj/GqNVdzXRi5ZvkOjbKr+5ZLjUujG7t6fVgbkc3m717NSP6V Y18A7m5/H1ElSS70TACGg0s4+zszPRBQdNBmlSu0yntNwkakCl+vkswZ37THoqauK53Njnz /M7Bg9mj/7UtKKdoM4//HwY0UWMURUUPyaWGdbuu9iMyUxHJUCO01yvvfvMYKjwQN7loDml 8XDfdskdYda4YvnAV/BaQ== UI-OutboundReport: notjunk:1;M01:P0:drImnaOOQ28=;AA/Bxy6dHJnX38U588CRcqYdFvo /jRkmv+JeN8SLIm4kh3GrVJAbSRyVKOBXH5rZP1EUYIKjo9Ew9rtrrZ8Xq0dTNAClLUAcYPMc 15uDjz66NLlLeba6LnOkydhmnz0NpZoyuR9U65hNEs/Nv+lF6USmavIXk9X90W0T+4e29nKA+ pPwaQKJNnIhibLU/IG6zcIVZzIrGR9Zsa57t3G7o208+UeN/3+InO3gvi5OIsz8NwkI83XKZ6 iWSwyvB67f/MrAZC1Bu6jsk/ZB3O3K3PUWZhWEGruED4U2Cqm/v3U/2WeF1jsKg8mDi1r9eFN PNpt89hteaJMaB4UT5uG17PA3pOkykCp1V3xOBdO9+zNJ1odVYa+0ss3qyXgXkSvwQacWnHmd 0yXKxuh64CCjfwVvXMM1Y0TtNKkw8Bx3q0cY7YGTI10OqHdzvPtswozKz/0IsyQe+++uvTRvt 7iCR0xMLnFTO0THocJShK2apS9uNfCuip/ADLzuzN4ssllLIN2trWFNrQ1ljqvid94AnZHhvg 4QikppiZspfFHJgxfYKNsDgEAOP1xq+pfGx2mZWmax/0W9MOXMu893F/twuDiaOSDTYc9JOK7 slGnwqaaFCiFwxeREF8TFd7GaqwRF/7uY7dI5RM4NaOT04eOf/e3jonbtGY7em0DDREc+9wxs 0IPZHIobq9f255Ipt1tWX70EDB39we3NzzxTvDSpmVXowfwLl+3flcA4xt7W3cWdBQ9B7kaZS iHNtOjI3MAs/Vlhj2OjEQN+ZjcK/R915Fi9OyDaQuobHi/lPv8W03HKqmM2Lt4qUQnLXNHLZ0 t/WujHUiHtTuIaH5Wzv561NSywc8t59TMa6zGv7rho7ZpHVtBec7G3OD+jqq0KmZa9eX5NRuk rRqAAgBikONjg0qlaeM01CRubWhUDPUHjOk9BxoEkKauQ3bVROT4gFT56myYBegwMH5vPM6Ah jqLnp+HT3Zyh7/KvZmcsj469OOA= X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 20 Oct 2023 14:10:51 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780310347869238933 X-GMAIL-MSGID: 1780310347869238933 When a WMI device besides the first one somehow fails to register, retval is returned while still containing a negative error code. This causes the ACPI device failing to probe, leaving behind zombie WMI devices leading to various errors later. Fix this by handling the single error path separately and return 0 after trying to register all WMI devices. Also continue to register WMI devices even if some fail to allocate. Fixes: 6ee50aaa9a20 ("platform/x86: wmi: Instantiate all devices before adding them") Signed-off-by: Armin Wolf --- drivers/platform/x86/wmi.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index e3984801883a..ab24ea9ffc9a 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1338,8 +1338,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) struct wmi_block *wblock; union acpi_object *obj; acpi_status status; - int retval = 0; u32 i, total; + int retval; status = acpi_evaluate_object(device->handle, "_WDG", NULL, &out); if (ACPI_FAILURE(status)) @@ -1350,8 +1350,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) return -ENXIO; if (obj->type != ACPI_TYPE_BUFFER) { - retval = -ENXIO; - goto out_free_pointer; + kfree(obj); + return -ENXIO; } gblock = (const struct guid_block *)obj->buffer.pointer; @@ -1366,8 +1366,8 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) wblock = kzalloc(sizeof(*wblock), GFP_KERNEL); if (!wblock) { - retval = -ENOMEM; - break; + dev_err(wmi_bus_dev, "Failed to allocate %pUL\n", &gblock[i].guid); + continue; } wblock->acpi_device = device; @@ -1398,9 +1398,9 @@ static int parse_wdg(struct device *wmi_bus_dev, struct platform_device *pdev) } } -out_free_pointer: - kfree(out.pointer); - return retval; + kfree(obj); + + return 0; } /*