Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1586033imn; Sun, 31 Jul 2022 13:06:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5CzLEhPMFCEIXnsxV6GUFID/t/XZJe/e063EjNxwt25j+vKKB1Lt2IxUlB8aLQ0XTgZUsf X-Received: by 2002:a17:90a:fe07:b0:1f4:203d:d192 with SMTP id ck7-20020a17090afe0700b001f4203dd192mr12036189pjb.145.1659298008858; Sun, 31 Jul 2022 13:06:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659298008; cv=none; d=google.com; s=arc-20160816; b=rInZ8Fa7VxVVJjsQBUAOtCDJ1TZ0MsQAz34z3TtGY6sBQLPx1ubXD2TNA8coIBdtVi eKW4fg5LZsd0r65PqpOuFvzk+XlYns8CMBjv8j5EmeSa1hwLGYgim+Ss1s0pj6Y3MH9U fxfLxTJxfZVDIL1S2iQ8y52rnbsn4x97DhKW/hUJugMP6oNmLQi+sPWp86h1a15bkV/Q OoxHRomxHF2aC/zBhUVqOQ5PpUR2cmS/nTg0QVPD2IuFBAHSfNk6An0xvTI5f2d6ywtx SkKmDh6gcpfIcsr+E7cpIV3SrRv32iujHUMg1Om3vH87GptnLKvh47b+HW7HNoE4X14S sInA== 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=eAsYUZl88DQW5NPn94nrchEEin/IAJiwY++ZdUJb6KI=; b=fqNaoOuOVw3tRkC10x/xO9N9IITEPheh8XdGxtRnKd3s8EtFXuN05awRbyKzIP8KPM 4QVseGrxdG/o293y4dJmiPbZRhTCwbXo2XoFC0eOsryToEElH4yjXcmWMfXy7Pk3fgDc jVuEaJsy4a5UnwjkGPFzr898v1NfPGiLC6udQc0MMENALJPcuxhjU3lZ/wdDqgoJNyAf 0Onfxjt/n5OsCkZCaGx7kPC0QE+/d+v2+FdYT+RzNtB6jucDkUUAc/0G907u4YaieA1g xVcQQytNvlxsExxBLcizfhfl0HLpQdrRT3mjptzFpNhXDiQQ9cuQPcZR+wZkToXXvy15 TWzA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 130-20020a630188000000b0041b8a07a6fcsi7550639pgb.673.2022.07.31.13.06.33; Sun, 31 Jul 2022 13:06:48 -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 S237854AbiGaUCC (ORCPT + 99 others); Sun, 31 Jul 2022 16:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233893AbiGaUCB (ORCPT ); Sun, 31 Jul 2022 16:02:01 -0400 Received: from smtp.smtpout.orange.fr (smtp-12.smtpout.orange.fr [80.12.242.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 312CCDF9D for ; Sun, 31 Jul 2022 13:02:00 -0700 (PDT) Received: from pop-os.home ([90.11.190.129]) by smtp.orange.fr with ESMTPA id IF8OoxSFa9RnzIF8OokYko; Sun, 31 Jul 2022 22:01:58 +0200 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Sun, 31 Jul 2022 22:01:58 +0200 X-ME-IP: 90.11.190.129 From: Christophe JAILLET To: Deepak Rawat , David Airlie , Daniel Vetter , Thomas Zimmermann Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/hyperv: Fix an error handling path in hyperv_vmbus_probe() Date: Sun, 31 Jul 2022 22:01:55 +0200 Message-Id: <7dfa372af3e35fbb1d6f157183dfef2e4512d3be.1659297696.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org hyperv_setup_vram() calls vmbus_allocate_mmio(). This must be undone in the error handling path of the probe, as already done in the remove function. This patch depends on commit a0ab5abced55 ("drm/hyperv : Removing the restruction of VRAM allocation with PCI bar size"). Without it, something like what is done in commit e048834c209a ("drm/hyperv: Fix device removal on Gen1 VMs") should be done. Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video device") Signed-off-by: Christophe JAILLET --- drivers/gpu/drm/hyperv/hyperv_drm_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c index 6d11e7938c83..fc8b4e045f5d 100644 --- a/drivers/gpu/drm/hyperv/hyperv_drm_drv.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_drv.c @@ -133,7 +133,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, } ret = hyperv_setup_vram(hv, hdev); - if (ret) goto err_vmbus_close; @@ -150,18 +149,20 @@ static int hyperv_vmbus_probe(struct hv_device *hdev, ret = hyperv_mode_config_init(hv); if (ret) - goto err_vmbus_close; + goto err_free_mmio; ret = drm_dev_register(dev, 0); if (ret) { drm_err(dev, "Failed to register drm driver.\n"); - goto err_vmbus_close; + goto err_free_mmio; } drm_fbdev_generic_setup(dev, 0); return 0; +err_free_mmio: + vmbus_free_mmio(hv->mem->start, hv->fb_size); err_vmbus_close: vmbus_close(hdev->channel); err_hv_set_drv_data: -- 2.34.1