From patchwork Sun Dec 10 20:24:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Armin Wolf X-Patchwork-Id: 176400 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6683431vqy; Sun, 10 Dec 2023 12:25:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IGHFu6BH2gRNd6Sywhi6BSKaBk8Rup1lTq27uOp12xjHqBxJBON2XtNwNtJkGltxTEA329t X-Received: by 2002:a05:6a00:b48:b0:6ce:6cec:ff26 with SMTP id p8-20020a056a000b4800b006ce6cecff26mr3950848pfo.52.1702239922641; Sun, 10 Dec 2023 12:25:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702239922; cv=none; d=google.com; s=arc-20160816; b=deLcMmA2RRy7sBP/QpIre0tZj8frzHdxfhAwZYz1d8VBP3B7vA4A8/efzD64xb9a6c FfjwUjghqc/hz753Ein4KUHqbAv395H3pHcDQ8GribQU+i33AxYDF8x66oBFPBdosaf4 nvy8MesDM47DRkJjNeF6eh5o9FdLjFFAvca0l74ineUNqWMLXyjS/48MJhB92FHtmwKO Fa4DBPwiBYL2o9qzo3OofGCKma51CT5i99cS3SwA1DAF0rDteNNwnlNXlP9ZROKGKkTV eHhVcLSZ83A9oZY0XrV397/1whRDKqSgTUXzA22J+tkuEmLac5yh1IiGOLmkKDaCrB/6 508g== 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=LEMJwxO7CGuQa7LwyJolyrSryTlCdeSHj6fnANjrZZE=; fh=li8yxIESWfZR7lmBO8wCmgOg4WdXsWPyQvEuWPhaOvo=; b=jpjwGXFKffu3c8MFw55qLRqeO6C+TiF761wK30bZd5JQ2wq2Yz5YVHAEaHQVdswSHl lewa1OEnXd/S1lxWsd6I63b1in+5iTWfkF6kyG7l6SyiwgBNSD+1Rh0WH3cCszTcJg9Y lXXu6s6oxQpTHIqRRHlKBTn5ajpNjW4lYkU6fePKb9mqUFObSrxR/+NFK9mnEe7DJzFT BlmfHqlqW9NTdlWQkXWy5j3Pi08BBOE4oV6pPfd0Z1s0JEODovSLSqYM7jNuBBZ+/xIS xdwlRKvYzdlDOKEG4xEoqpOWLAgyIMx0gYuV+aUrg2kHdd0SNJOQKYde3r3cirg8AswF zidA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HL4fAqYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id g26-20020aa7875a000000b006ce7afb03absi4850225pfo.131.2023.12.10.12.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 12:25:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=HL4fAqYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=gmx.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id AA20980758E7; Sun, 10 Dec 2023 12:25:17 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232040AbjLJUZC (ORCPT + 99 others); Sun, 10 Dec 2023 15:25:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231199AbjLJUY6 (ORCPT ); Sun, 10 Dec 2023 15:24:58 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14411ED; Sun, 10 Dec 2023 12:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1702239893; x=1702844693; i=w_armin@gmx.de; bh=bcwM7hu/lcoNUcXT9dFzmhq7Supu1dDMMBv0VFimJQo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To: References; b=HL4fAqYkma1u8ZKR7xX4zuocV4SBj/Kw6H//5VBdLrklAsq0VriX7YABvcuOY7XA wsdNzq5i49THtS6eznSB3V1PoMcBVjXiS+rYFEmUOJyzId1NGMRul2IxR58Cpmo4U wSgCn81ZwYp8yro7L7zmmxDZi6jf65AcAEK87/fMplKDiKZQWkyH+mXbQzvDRUw7T X/++mmDQ3im66egR0lDtr/lGyytUTuluDIFSPa+LeFbWpfSTZkQjfazuO9JUaqawL bg6PuoWMpy6vHl3QRujY1MC8/14+ZCBy/UxrQIS4N9vVSNhuG7MeIExtfcu7OrhZF ekddb8gJk+Bl6dlZIg== 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 (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MuDbx-1rVall3qw9-00uaqy; Sun, 10 Dec 2023 21:24:53 +0100 From: Armin Wolf To: hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, corbet@lwn.net Cc: Dell.Client.Kernel@dell.com, linux-doc@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] platform/x86: dell-smbios-wmi: Use devm_get_free_pages() Date: Sun, 10 Dec 2023 21:24:41 +0100 Message-Id: <20231210202443.646427-4-W_Armin@gmx.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231210202443.646427-1-W_Armin@gmx.de> References: <20231210202443.646427-1-W_Armin@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:BDkhbzp0Ms/xMjG+rWvrcWO0esNvAHqEEaXbO9olz0GfgKb9TNt Rbk9twGQV9tWEi6WzSVtYF9ar9PDyjM2P9UDz1MsLXF04ja490vPd7+gLh9D0cLtc6n87q3 oygjGyB/uRHcDhRh2/5itNDJMkkS1tZeTDk/OP1FBi8XcvxNjaz1e90SXPuA0siLM8rcDIC FEV9bZeaPF5DRfn/hDTYQ== UI-OutboundReport: notjunk:1;M01:P0:vLvsShTP23A=;RmVEsdEKKFRbmbwMkzI8si2pJzM S4wk2Ea46NLWGCFPHRczfqFK9q35pBrRzAdMsQnqJMJOfkVF2ReSmSTaBS7mc7guwl8i8w18A b8SrSPPDRtMGlOL6JI5qsa2OvIA2QY37XWRFakEheL6yA6RzffGWKbRA+DaaZ0cP4VdQggRZ5 59XhbEgWx12+uTMP1sXrCjrLBjrpUQEVQ2IJ1rK5lUA4lhp8yL6R70qMWOqJ65aW+ouFC9cPD OpnB4Umn8wqsjHyT10INl900GAlaeg8a4ZuATbu6mEdVbmhpXeTLOj29iBml7NipWc3VjaPTE SD+5k4dbBPYJ+IIHf7YrKGc0zV2M8L0m/DarR6CMpFu2AGzClOsfcLZPW0NizToJ9mY940e0T A+AKBVTgPN6bEZYxOWrYrIuBDewIKZBilcSEncBZvBi0Dp8tR6oaG2Zkoq/RWYHrfVeDv558L i6QGzRMXe7dg3Lx6ebr1mpAckshm8fXtkCcdhYShlttdU+EgJLieUJbTWIfX21tFjiN7QOpm3 44eVf05QrHWD0OeEug4XGVAgD/wksjBEkX4AAyD1C54J0fYHm5ms5XDhEJPTvzWEp4q9mDmdl 4PRK9fYtsl+q47+i9BZ8MQShjiSSN1h+0pvMbmRpUkt803A5lw2vxAEobefX0qMjnLMf1iBSO jvI8PyrkrUAbPYVjdMMRByMt1NnpL4vckPj/A0h9Jc8LNbVIp0VFLiEoPRnRq2nhEKg0Qpk3p uwO8RcMSb+qlKz4lXyzNzz+6s0DWiyGTb5VlgF7DaYQ/mqR3xFmw0zB0ldiffnHcZ8vGyF2ui EKfy+f0ykNHgko7EhH0+QGZU4M6tSAPY6yA5+0NH73Y5CEsiQYL2mPbD6OfqdjUSvrhV5zmji lw4CQxm0Fse3cLrbLbieawh/oWLqWLEmmnrHBHHyOYwOM1GysCRSyNYgT1LgnhdZQnJBvQwkJ xJgU5eXFoVpRygfhmZgf8zsssMI= 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,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 12:25:17 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784927929063725966 X-GMAIL-MSGID: 1784927929063725966 Use devres version of __get_free_pages() to simplify the error handling code. Signed-off-by: Armin Wolf Reviewed-by: Ilpo Järvinen --- drivers/platform/x86/dell/dell-smbios-wmi.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) -- 2.39.2 diff --git a/drivers/platform/x86/dell/dell-smbios-wmi.c b/drivers/platform/x86/dell/dell-smbios-wmi.c index 931cc50136de..7eb7c61bb27d 100644 --- a/drivers/platform/x86/dell/dell-smbios-wmi.c +++ b/drivers/platform/x86/dell/dell-smbios-wmi.c @@ -6,6 +6,7 @@ */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include #include #include #include @@ -183,7 +184,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) return ret; count = get_order(priv->req_buf_size); - priv->buf = (void *)__get_free_pages(GFP_KERNEL, count); + priv->buf = (void *)devm_get_free_pages(&wdev->dev, GFP_KERNEL, count); if (!priv->buf) return -ENOMEM; @@ -191,7 +192,7 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) wdev->dev.id = 1; ret = dell_smbios_register_device(&wdev->dev, &dell_smbios_wmi_call); if (ret) - goto fail_register; + return ret; priv->wdev = wdev; dev_set_drvdata(&wdev->dev, priv); @@ -200,24 +201,17 @@ static int dell_smbios_wmi_probe(struct wmi_device *wdev, const void *context) mutex_unlock(&list_mutex); return 0; - -fail_register: - free_pages((unsigned long)priv->buf, count); - return ret; } static void dell_smbios_wmi_remove(struct wmi_device *wdev) { struct wmi_smbios_priv *priv = dev_get_drvdata(&wdev->dev); - int count; mutex_lock(&call_mutex); mutex_lock(&list_mutex); list_del(&priv->list); mutex_unlock(&list_mutex); dell_smbios_unregister_device(&wdev->dev); - count = get_order(priv->req_buf_size); - free_pages((unsigned long)priv->buf, count); mutex_unlock(&call_mutex); }