Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp618799pxb; Tue, 5 Apr 2022 16:08:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKjMaUmwsNabJxN4K0jKo54VVwcA5YMmuU5a2ugPYzIoVXG8n9ppy6I9hIlsw4aymM2Tg1 X-Received: by 2002:a17:902:70c1:b0:156:16c0:dc7b with SMTP id l1-20020a17090270c100b0015616c0dc7bmr5759070plt.85.1649200111057; Tue, 05 Apr 2022 16:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649200111; cv=none; d=google.com; s=arc-20160816; b=uMx0O6BP1Fd3WFAk9O3GAK49ZtP1kt5uGxJIZSn9goPqdOE55PdF15sV/htoR/giOJ eL+2A31VgtPVN5bxOM17sceGzaaah6WI16Kqp6tUAswFim76hIQArHshirRnEzlKv21w mohRd/DArIdnmzb1sq7HaUi5d4MtWCPRlh/ckR5ECzKh6bzXMdk3LsimkFVhL/h1aR8Z cEVZIfwP9NLJ24zr9fpgZwJ1/N6ANUXTJaLwn2VGOp6IybXY9s8jrZVnp8QCTFYNCnd3 5re7H8ExvapxK9orMs2nd6HHZGGVz6QeXRzfohx7+cv/R2FqEAx6207ZD5ZLNYsYTnbL Hixg== 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=F8/KIO/YGQedLJ4xg457YhiIowxnZSRxOc2U5ZmuHDc=; b=VlmTn/zzDqzmgtgp0DvTJHCCKovQ5uVUhO0VdDTxdjmuf99vRH69zDS8EjdpxBytLZ 7a/i5AZeRgFWyR1WugTIZ+1drRkwX+egRhiqcFR4+XurwzEVI0sSB8cq0UjF1plx9fSJ E9l/xpcWa+lbbRg38ixB9t4C4R2FFNs6U9jYKEpiMuCg46/R5kNxmUtWoKZSXJuKNMfu ccqoXFlX0MRlTPba+RQWKbTAZW5kYWNqW/4+YuPYIgE6Zaj/LsPX/SNHiDH54Vi81z0F pFS1r1chYSz6lBJH0IxfI1LJHzIiBXBaW6tsr106AedTST3D5mEkAocOjhLU6fJ1/d9j dcTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o+w4Sn/p"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id k68-20020a633d47000000b0039958f2ceb2si3976460pga.101.2022.04.05.16.08.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:08:31 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o+w4Sn/p"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 62F72165A88; Tue, 5 Apr 2022 15:52:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358398AbiDEK2V (ORCPT + 99 others); Tue, 5 Apr 2022 06:28:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241363AbiDEIdW (ORCPT ); Tue, 5 Apr 2022 04:33:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9E6C4; Tue, 5 Apr 2022 01:31:24 -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 ams.source.kernel.org (Postfix) with ESMTPS id F2D90B81BB1; Tue, 5 Apr 2022 08:31:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DA24C385A1; Tue, 5 Apr 2022 08:31:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147481; bh=VneNOaM9mJpTwqnsaz3AMAgYN5lJVKmSjFQ175D3ec4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+w4Sn/pDfkD+oWqWZBK2hpo52IBXS7J12FSJI+3MYXHQamnfE7ZxTu+JrLPZrYyY 65gPjewLO5OVws0ZM71r174HgZuIGXAjMqbzZlifWfoK+1OCMNI1uk0Ru3FiBBeUDw wVpCJjGYcj83+Y+TnDwEKBD6cZqJunklOxuDnqO8= 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.16 0014/1017] ethernet: sun: Free the coherent when failing in probing Date: Tue, 5 Apr 2022 09:15:27 +0200 Message-Id: <20220405070354.596557807@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@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 ad9029ae6848..77e5dffb558f 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c @@ -3146,7 +3146,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); @@ -3179,6 +3179,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