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", },