From patchwork Tue Dec 26 13:28:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 183315 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp862697dyb; Tue, 26 Dec 2023 05:28:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHkKOFST4hkKgEt5kQEgjnYcYDG1b5v+I7NgQpmVGck1tDl17M5xoEbOhHcBhkt9B8kZ6rU X-Received: by 2002:a17:903:26c3:b0:1d3:efda:2671 with SMTP id jg3-20020a17090326c300b001d3efda2671mr7686764plb.19.1703597329303; Tue, 26 Dec 2023 05:28:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703597329; cv=none; d=google.com; s=arc-20160816; b=JQ04aEsO/lz7P9BmT8ocYe1XFlCo7G0KMQknYcXwlvHVu4iNBhLzbaocg7P6OsTNLy nsYu7xEeCXgNufEUqGl5pe0R42ICTIU6BoQUiWLcLbGUa5BulsdFl+oYDwDEUICmCWot gFtOdj0bmMmtoO1YHXXuFLEn8YIh+TGD157zz4nCl3xvj1jgCYWfyAdjPzTuePUIi8rE P+NStk0RSwIkJc1SdrcGoKEou/XDGhyg9q148+gqxqQi8rbwWI0lUMQAU6G5JL5oicgP LGojqjF2dh8rbQXOkvEz9aOR6RcuODe0zk+a9DrF2GJlgPmWiage0J9BrCukj5o7UIkQ H7Dg== ARC-Message-Signature: i=1; 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=5LKUghNjSLJ2aoOVo5dxNSkHXTNp2mWbZkp52MM6q9Q=; fh=XaTqR/2qXzY/zSYNV/jctYbDgh++p8ja6kzJiUxOQys=; b=LONLF73KhwRLxVnOwlccOcuBhedvyARbz7cZyR/gE+ySKViwOLyDAPFHJqBRQ8PDt4 sYJ5QSWaf8R2Quo5Mm0dAO9Gdz7UzzXV2p6ygto90RNmoeJna2KWSzNlsiPih3GNOtoE GGf3fl4lIZrdREOYOnn+TKB4nL19MHFTekbpWCV+f0hlb8CRbWFJcIPOxtSipLPINWni Zz00W77lBMMuKtjt1sbfxVWBsVLYy6VU/j0TjVFocdIxjqeACFO0IgeNFljHwYt4O8wa aEGLWPuVZWKxsC4Fwo/T5X1nYTWVvQ3qmOhvjyElB+k2sLDwaCOjN2R8ZFqg5KyzvdTu yj3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11519-ouuuleilei=gmail.com@vger.kernel.org" Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id bc7-20020a170902930700b001d09c54485esi9257786plb.568.2023.12.26.05.28.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 05:28:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11519-ouuuleilei=gmail.com@vger.kernel.org" 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7B884B21917 for ; Tue, 26 Dec 2023 13:28:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 87C254F1F2; Tue, 26 Dec 2023 13:28:26 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 C1C644EB25 for ; Tue, 26 Dec 2023 13:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rI7Td-0006yB-Ok; Tue, 26 Dec 2023 14:28:09 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rI7Tb-001ePq-CM; Tue, 26 Dec 2023 14:28:08 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rI7Tc-001FXA-1G; Tue, 26 Dec 2023 14:28:08 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Dov Murik , Ard Biesheuvel , Dan Williams Cc: kernel@pengutronix.de, Gerd Hoffmann , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] virt: efi_secret: Convert to platform remove callback returning void Date: Tue, 26 Dec 2023 14:28:02 +0100 Message-ID: <4a97c8e6996c9c95244715310b57ce5af6ccb1ad.1703596577.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1623; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=HZawbBGN4ZeoKoNwMa9p/anf72qdPDLDyflq3XBOU2g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlitTiF7Q6LPTBILQzLPFujFV4KCr1bTgHzw6NW OwjGqfEtpaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYrU4gAKCRCPgPtYfRL+ TkBkCACeaJNlG6+8zgivZjAdP0unbo7IwQwQBaiq7ypeRCwzJCDAqGQwyMju5tlx3ArltRsdnqH ZRU1TbnKe14zmg09+lFYV3ix30OhcDomGQvKoVwstNquuHPOkiRZA+8rtGXQzMxtWz8Fz706qqm 8utEqC6IgubmAlTwkETt9DpBgVc+a7dUD1YkS4s8fl04qIJICkNACClyT58nsruiNOdfvQxEpyt 1ANnl1yiWrSVeLMgAcfxISqwosqYib2fhYqG/poy6UmM928lcu5cup2b/rS959RvgmLdMeecgJH S8IJ70jrNPuEXdncItYBFgvHKb+33dZ8/Sgp0t//wPAfZQQm X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786351273029869236 X-GMAIL-MSGID: 1786351273029869236 The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Ard Biesheuvel --- drivers/virt/coco/efi_secret/efi_secret.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/virt/coco/efi_secret/efi_secret.c b/drivers/virt/coco/efi_secret/efi_secret.c index e700a5ef7043..cd29e66b1543 100644 --- a/drivers/virt/coco/efi_secret/efi_secret.c +++ b/drivers/virt/coco/efi_secret/efi_secret.c @@ -326,16 +326,15 @@ static int efi_secret_probe(struct platform_device *dev) return ret; } -static int efi_secret_remove(struct platform_device *dev) +static void efi_secret_remove(struct platform_device *dev) { efi_secret_securityfs_teardown(dev); efi_secret_unmap_area(); - return 0; } static struct platform_driver efi_secret_driver = { .probe = efi_secret_probe, - .remove = efi_secret_remove, + .remove_new = efi_secret_remove, .driver = { .name = "efi_secret", }, From patchwork Tue Dec 26 13:28:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 183316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp862712dyb; Tue, 26 Dec 2023 05:28:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/f+tTJ1jUjzur08WO3l/X3tJ5J0UBR49EwRWFbWSAF7ICyNOc2Dh9KPgR9c3etpjuYZZ6 X-Received: by 2002:a0c:ef0a:0:b0:67f:971a:8919 with SMTP id t10-20020a0cef0a000000b0067f971a8919mr9585839qvr.114.1703597332041; Tue, 26 Dec 2023 05:28:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703597332; cv=none; d=google.com; s=arc-20160816; b=u9e58ECa2hvrB0+Hnnl+RxePt/80BKCqgEiUnzQuVZuC8vq9DWWgtc/yxqpYdJyMCR 2kDZEsLRjL9O1OQtsotbSUAbUxX5Op1owZHTvPRJsJ8Zl5VqcHzGpoEXWOfJVAfSb8Bw Nl3RqrXN8xWIIH1dPlabr9HhYEkI2zyNNXVloT/8dzmvgrDmtvgsa4KuFCTboh7Fa8I5 GgmEuNZoW67e6eJqgiviAKDsDRHUzPXGg+s92yUqy2LZgee10iqQbJwlLKgqW03XxCxd 72uzM55gsCZMQCYbsUaHiRslRSJA1EgRf9OMEIT66VOgmmuOJhXrwphsijJ7pPiQB64O FuNQ== ARC-Message-Signature: i=1; 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=uWeEiXSl1c8Bb+o1DCbiec+KVmN8ZZGglZYF5JQ9XW0=; fh=BUIGpFKmA8OkyZxlAcZxmphQ2alsMsfAXNp8CCcoai4=; b=Ht3rFXZky+l7FSO5toqmtUwKXTeotJPw3DaRNkkBpGwcpizO7qqiBS2wglJeV3bASU mZTRm34DMxLICfDmoj8Ixmi0GwARJnNlP9VBoQIIOf9HUHTAZ+dkbvgPiytaBY0Tnnqb A/n9N8y0SB7J2ANAye1wsdiMqYDgYE87xTQC1zyCjrXDpG1uJ2qVSLGHuqoMQfbaZ6BQ Dr3ROLxyPpU2asA8Zxv0UFA2Mxb4Tw9EDSiOEydBt9Kcwy3SFKURAP4rJv8eo8C4Otsz 2zkk/3hZebaHfA+slpk5ExEeAa4g23q/ZdZ2Dx7PiTAQ32PJZWVbPvsx5Z80c03sTc8v bUyA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11520-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11520-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w16-20020a0cf710000000b0067f827b4971si11302738qvn.262.2023.12.26.05.28.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 05:28:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11520-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-11520-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11520-ouuuleilei=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D33921C21DC2 for ; Tue, 26 Dec 2023 13:28:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E5274F20F; Tue, 26 Dec 2023 13:28:27 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (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 C1CAE4EB42 for ; Tue, 26 Dec 2023 13:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rI7Td-0006yC-Mh; Tue, 26 Dec 2023 14:28:09 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rI7Tb-001ePt-Ig; Tue, 26 Dec 2023 14:28:08 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rI7Tc-001FXE-1u; Tue, 26 Dec 2023 14:28:08 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "Borislav Petkov (AMD)" , Tom Lendacky , Dan Williams , Dionna Glaze Cc: kernel@pengutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] virt: sev-guest: Convert to platform remove callback returning void Date: Tue, 26 Dec 2023 14:28:03 +0100 Message-ID: <52826a50250304ab0af14c594009f7b901c2cd31.1703596577.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2006; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=Z9aT60piXZDenK8RXiwhRNc00a89v5TJn3r6r5ZOBSU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlitTkkryV046r2EvM0Kp5YL+HNUQO3TXiGbD9l 2tRsZojeIGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYrU5AAKCRCPgPtYfRL+ Tm/uB/wJ+agFq/MhyVjquWnf9zywJi0+vLwwlpPo4h3nxK4oSCRQot7xQzCoKguDi69/UYxgyf2 3PIsn/U3cVNsgs0pmekTtY5A4L2XcGSQiNwKlOIrk5iYTe6JgLfMJY4oCU5MAgEY6gD6VjierdC FHuodU43E7FImEql3jDMCL2BS1MXGJ0dv+JsZJf1It/3p3IoUwhIyS3EWqn4+yL4vW+ll0MkNly 3m/bAYVsl/yzSpnZ2HDkMbity8fpz5D1scLZUsRUZW+wlE7ysbmUCiTEAJOafoumoCAh68sWU5L MQeZzUNk1NNaMMH3LhWg+h10lWzTRw8msJMmjamY3O0Yqzt3 X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1786351276277418216 X-GMAIL-MSGID: 1786351276277418216 The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new(), which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Tom Lendacky --- drivers/virt/coco/sev-guest/sev-guest.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c index bc564adcf499..87f241825bc3 100644 --- a/drivers/virt/coco/sev-guest/sev-guest.c +++ b/drivers/virt/coco/sev-guest/sev-guest.c @@ -994,7 +994,7 @@ static int __init sev_guest_probe(struct platform_device *pdev) return ret; } -static int __exit sev_guest_remove(struct platform_device *pdev) +static void __exit sev_guest_remove(struct platform_device *pdev) { struct snp_guest_dev *snp_dev = platform_get_drvdata(pdev); @@ -1003,8 +1003,6 @@ static int __exit sev_guest_remove(struct platform_device *pdev) free_shared_pages(snp_dev->request, sizeof(struct snp_guest_msg)); deinit_crypto(snp_dev->crypto); misc_deregister(&snp_dev->misc); - - return 0; } /* @@ -1013,7 +1011,7 @@ static int __exit sev_guest_remove(struct platform_device *pdev) * with the SEV-SNP support, it is named "sev-guest". */ static struct platform_driver sev_guest_driver = { - .remove = __exit_p(sev_guest_remove), + .remove_new = __exit_p(sev_guest_remove), .driver = { .name = "sev-guest", },