Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp3398921pxb; Tue, 19 Apr 2022 01:20:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyP7qdjcn424uNQOgLtcsvyuC0R6tExbwCsU3QSH6gSLWo7zseKAd8viyTjkjvsbvz5OBpi X-Received: by 2002:a17:90a:c68c:b0:1d2:86e2:aea with SMTP id n12-20020a17090ac68c00b001d286e20aeamr11550758pjt.182.1650356456568; Tue, 19 Apr 2022 01:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650356456; cv=none; d=google.com; s=arc-20160816; b=H/ZsUm4lt/hDrPIytwFmhj2KsH1TMoexfPFOr5TFfb9H6fodT61kqvGwPaUPfqVKpp k+PhUidl6tl3l34DxbJZ2sIN6iunvlvTdn3a1pyzYppv6eOtN83A1+XHh1M+/3kGXD7i z9YwijQ5DUyMqJ/PqgvsYn7eSDI0MqmdHtE5LJjxoFpsOx8PUSexq1PDpriSu7HgJiqq EHse25x+bq77sQCB5Ttg+CfkTyPkuFFH/dMlFRTfi+VC+JukX46hSmGsH2eysG+7ect+ A0mKCneWDe9L30eLKK7Z2IHsPX3INdpLoFp641LOW35GRan9u5UpWKreHA4P2Hl5HeTE r/RQ== 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=d9JlYQ9dygpL5llLtqiPnk0cdHk1W+XHWGyRS+Qgh5k=; b=fbSwnfmAu93fqPAcDFHfXOngjqjKJwrRgTFoYkevgXHuy2fxiIt14Xl7k+FXY/7ErA b0pErkrb22jbdefMzlJaI0OwniNwKKLIaLyOBbVfjUgyvjZXxBD7dHmeyZtrQgB/2kVi 5BZUrwegeAgiyz/J0+Fzz4jhRe/Hrs58Cp7BRIT+0QKNF6k29S7jGy1INvj680bU8Jtn UvbiUik0fYW4fK9c6LY98dsyOvR/yB1XEQ9GdtBjT72czaUg4yq2p2ajWKe/zsXebVT+ Tvdel/pqfdD6aSLeA1CRNB7GF69YbgGtWa1ji3KiZ+oQZKuHze3qUYfyhlB7hcOfTvoj C4kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WHPHmsEU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l7-20020a170903120700b00153b2d1665esi14384094plh.614.2022.04.19.01.20.42; Tue, 19 Apr 2022 01:20:56 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WHPHmsEU; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241391AbiDRNfo (ORCPT + 99 others); Mon, 18 Apr 2022 09:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242824AbiDRNJ3 (ORCPT ); Mon, 18 Apr 2022 09:09:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 370F4369ED; Mon, 18 Apr 2022 05:49:03 -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 3377F61259; Mon, 18 Apr 2022 12:48:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1D50C385A8; Mon, 18 Apr 2022 12:48:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1650286134; bh=m010D5kfjHCZrOKrDHaOt/zruGT7jWSVi3xsW6bm/1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHPHmsEUL3AIZ9jjrWDcWE1/myKT/fJ4fEJ7YvIKN9iAPiXsWgG/4je8Sct6KBS+K S8YSHn3np8yJ8zYaUvcirxtl2jTL1+AXcQwLaOW8R742dpu53BmPGVWIi7gmTx9z/K e1JLKEio6/v2v0mtvIAs63kTAlQVBJdvKnsGVbJI= 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 4.14 005/284] ethernet: sun: Free the coherent when failing in probing Date: Mon, 18 Apr 2022 14:09:46 +0200 Message-Id: <20220418121210.849128396@linuxfoundation.org> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220418121210.689577360@linuxfoundation.org> References: <20220418121210.689577360@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=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 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 9e983e1d8249..7522f277e912 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -3165,7 +3165,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); @@ -3198,6 +3198,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