Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp953411pxb; Wed, 6 Apr 2022 05:12:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoD34m5eoyYqbILwB097vhAj/STr9TYNxbUSh+tUX7jvZOc5YCtH0/UVnZeHRP6h8MFoXa X-Received: by 2002:a17:90b:4f8d:b0:1c6:408b:6b0d with SMTP id qe13-20020a17090b4f8d00b001c6408b6b0dmr9449098pjb.90.1649247155039; Wed, 06 Apr 2022 05:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649247155; cv=none; d=google.com; s=arc-20160816; b=BrtQpyzmLpNpJZ8W5Zau65oLFwCJWkGZuXac/7ZoGwmWYC2cjugbivdMJe0eHMWDO+ NP9Vx06aN/00MW7wjBQVM0f8CADN5yjFE8LLbqpYiIpjdqNU23AD6qP7/0veQiHqYcGL 4VwCA6FND5U5/oyTV552mXo7K6pLQCMfB6XR0K7hZBF4PPwzo6gX2fUZRKHhwacb9bOm UxhTcBjaCiAII2eIQ8fen4VvyN/HfM24D4b7cch8oZiJQSWgEB9jB2clcK5TyVa8GF10 9CWTK5h3c/9P4lAV+Zv6E4rhwEtNs9Qg6fiWNZh+putFG/j/eSptNsFMcT0Ycl+5pOg4 Xk1A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oaO/oMTZvO8milparnsEa2bmoE/MP0+AbLQMvsiEOIc=; b=CEY/TOL1fKV7+GiHXRopW8fS9D+chBzd1QRDMXTZ6DroD0BgWk3cd899ppyz+mCUxE 2iy3XBnM98J+nqbGcF2Uj7HJ/7l0WnenDag5x6ITKSnlNdy75SQsMu06LeYMmmP2XClE l/KPLttYRhftAOkK8q5EH72OPialv7z613HZM6zZees3F4kmA1xQ1jlLSOPVPNTncUc2 wg+I9biVPOTqyGjC42rUjwiYELiWyx+CYXBYU4F7Ns4ywwDeU6nhd0I87yRo4/eXfBDF gweA1ZHbvqtUcBHjtNEVN0s35V1Bv9fSu6tUwb+tNU2KJjDYn+xw2/IQcxrd+9Qwzxxb QURA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4EV08XU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id bx5-20020a17090af48500b001c9e78218basi4519019pjb.84.2022.04.06.05.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 05:12:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y4EV08XU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 88FD75100E6; Wed, 6 Apr 2022 03:50:16 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344299AbiDEOMc (ORCPT + 99 others); Tue, 5 Apr 2022 10:12:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236156AbiDEJbN (ORCPT ); Tue, 5 Apr 2022 05:31:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3078D638C; Tue, 5 Apr 2022 02:18:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4733561576; Tue, 5 Apr 2022 09:18:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5434EC385A3; Tue, 5 Apr 2022 09:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649150317; bh=icmzaQjTA2AMAeSYFVcRD2WKyO+/3zIAb8Ggsg0MqkQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y4EV08XUgfUy43TuGczAxpKlfjVhfRuYeoa7JbJ9bsHcq+AiR9mKpfsUhta9k+Po9 HWcMipond7iViyx99Tziqhaz7h/mQ33aJwojcZiKnwP9bhoFKLe9cFsAVOFd4L5PM2 fEPEXr6U3RJg51dz1aoHX56d/c83lL6nq0Jt/uCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Andrew Lunn , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 015/913] ethernet: sun: Free the coherent when failing in probing Date: Tue, 5 Apr 2022 09:17:57 +0200 Message-Id: <20220405070340.272075166@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Zheyu Ma [ Upstream commit bb77bd31c281f70ec77c9c4f584950a779e05cf8 ] When the driver fails to register net device, it should free the DMA region first, and then do other cleanup. Signed-off-by: Zheyu Ma Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/sun/sunhme.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 62f81b0d14ed..b05ee2e0e305 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -3139,7 +3139,7 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, if (err) { printk(KERN_ERR "happymeal(PCI): Cannot register net device, " "aborting.\n"); - goto err_out_iounmap; + goto err_out_free_coherent; } pci_set_drvdata(pdev, hp); @@ -3172,6 +3172,10 @@ static int happy_meal_pci_probe(struct pci_dev *pdev, return 0; +err_out_free_coherent: + dma_free_coherent(hp->dma_dev, PAGE_SIZE, + hp->happy_block, hp->hblock_dvma); + err_out_iounmap: iounmap(hp->gregs); -- 2.34.1