From patchwork Thu Oct 20 19:21:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 6365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp291775wrr; Thu, 20 Oct 2022 12:44:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6N/DbVkyZ+RKbsAQMG3gmUMCqXmFrSCoX6DuCiw+IT5+B3XPgjUInD6av831hhAHQarYL/ X-Received: by 2002:a17:90a:4404:b0:209:a883:7f45 with SMTP id s4-20020a17090a440400b00209a8837f45mr29459381pjg.106.1666295034223; Thu, 20 Oct 2022 12:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666295034; cv=none; d=google.com; s=arc-20160816; b=oPo2a3G4gCWxV4CQcXp3Cjm2GGEr3/VE70jHETY7z4WUux3zKrr8Rs7WCiXrUKcbC/ pKeBO+u7oPMaWrjcVqt7l/1Sc2rFWH+Oihm7pKHfNgANec42mn/ujb5G0B+j/mfiMtj3 VKv5bTgTbxViPyR5hDsR9ZTuWVSzNoazmV/rv+C2tQFm0jp7K6uEk+YXzG1ImtbinNv5 0UbFvo7qrJhmNrs026UHdD3ugz0AkQfIVGb65cq/pS7cC7pJIq5WpSlJ4vIcfnQ4V+S+ VNxhsKbespjaYALYeIbZSX7Fgek1FbMz63IREOEqBQNk2Mr9e5c1bHGgh9WsCcr1hmYc jO/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=x49Z+7yaL6RwbBM/d/Smlwh4k0EElIW3u2px9DPPbtA=; b=sG/Q1O7a8AmLSWVvJ1biBzWFv0DY9NUyATjUuDkgLPLU4jWKwkn54/ST8PanyzuCk9 jy936iBdW5R9llNdfPdarWjhvG1lyliFbiQHFlV4uAxrs3847Y/Y91QAQO5T8LeYWrNY n0CcTTZzbV2mpMQT91lkaOwKLKJNUrxEMKwPxA/ko5VSaC+4ZhYnOsol4wy23EIotSny pv2zx1852bE6Aw+syI2l2s7REZ1TtfthGE2hDscHWJaJO1KJXljtk6ILf7b+O3kXqhSn +c/5wu6yQNYlacNEgxUVUkdBHsLRVBA0gRgiRGdcq6QUPrpOhgWkq6cHGw6uCeJXLkdF 6byQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot1-20020a17090b3b4100b0020de216d0c4si5391412pjb.61.2022.10.20.12.43.36; Thu, 20 Oct 2022 12:43:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229484AbiJTTVV (ORCPT + 99 others); Thu, 20 Oct 2022 15:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229449AbiJTTVT (ORCPT ); Thu, 20 Oct 2022 15:21:19 -0400 Received: from smtp.smtpout.orange.fr (smtp-17.smtpout.orange.fr [80.12.242.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9156D1E8B9A for ; Thu, 20 Oct 2022 12:21:14 -0700 (PDT) Received: from pop-os.home ([86.243.100.34]) by smtp.orange.fr with ESMTPA id lb6No437EXaJmlb6Nox20h; Thu, 20 Oct 2022 21:21:12 +0200 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 20 Oct 2022 21:21:12 +0200 X-ME-IP: 86.243.100.34 From: Christophe JAILLET To: "Michael S. Tsirkin" , Jason Wang , Wu Zongyong , Arnd Bergmann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , virtualization@lists.linux-foundation.org Subject: [PATCH] vdpa: Fix an error handling path in eni_vdpa_probe() Date: Thu, 20 Oct 2022 21:21:09 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747236981804470286?= X-GMAIL-MSGID: =?utf-8?q?1747236981804470286?= After a successful vp_legacy_probe() call, vp_legacy_remove() should be called in the error handling path, as already done in the remove function. Add the missing call. Fixes: e85087beedca ("eni_vdpa: add vDPA driver for Alibaba ENI") Signed-off-by: Christophe JAILLET Acked-by: Jason Wang --- drivers/vdpa/alibaba/eni_vdpa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/alibaba/eni_vdpa.c b/drivers/vdpa/alibaba/eni_vdpa.c index 5a09a09cca70..cce3d1837104 100644 --- a/drivers/vdpa/alibaba/eni_vdpa.c +++ b/drivers/vdpa/alibaba/eni_vdpa.c @@ -497,7 +497,7 @@ static int eni_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (!eni_vdpa->vring) { ret = -ENOMEM; ENI_ERR(pdev, "failed to allocate virtqueues\n"); - goto err; + goto err_remove_vp_legacy; } for (i = 0; i < eni_vdpa->queues; i++) { @@ -509,11 +509,13 @@ static int eni_vdpa_probe(struct pci_dev *pdev, const struct pci_device_id *id) ret = vdpa_register_device(&eni_vdpa->vdpa, eni_vdpa->queues); if (ret) { ENI_ERR(pdev, "failed to register to vdpa bus\n"); - goto err; + goto err_remove_vp_legacy; } return 0; +err_remove_vp_legacy: + vp_legacy_remove(&eni_vdpa->ldev); err: put_device(&eni_vdpa->vdpa.dev); return ret;