Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp449674iog; Mon, 13 Jun 2022 06:12:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJythLQI7g1WIZkoyO4tBWog89Nrt6Ue6hWVsRObnXxFNEEs0wvj7Pq7xELjOHrEZnJfwQNW X-Received: by 2002:a17:902:bc84:b0:167:80c6:aedd with SMTP id bb4-20020a170902bc8400b0016780c6aeddmr39242544plb.97.1655125933496; Mon, 13 Jun 2022 06:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125933; cv=none; d=google.com; s=arc-20160816; b=dBGtYXTbYyHd+IRitIg/4PW6yJGHw2O6P1XH2VYAPALmEMwIyeg5vH8haj6KbJpzqs wt3GsxSpMTHgIFp8/KXPalW55/Gcby5DncnzWtINx6DH2QzbU1W4UlVKpIXiMQIEpvSn lXV0g7G+GwAnF3SEMC4lfm7aqb77fKy/SN+YDBtQJFiPoQWXmjo8CSqisdYi+n0gZOLf +C/w6+TYKNxj07kniDaHevOM/BKFMC78UY6c0KOrTx7uHn4d8an2/UapcDGfvEDD4rhm hHSTh2Vmb5MOKzaR0/elNhJHzvr8jYVverKWaqM0uVkFcS9kFUSUYp6KIkCE4q9bvh4h jIXA== 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=tKLdTN73gwC3x9mCupJpvip2AbmUfsWgq4expij669A=; b=xxp6uCDbNjHEsRXdndNHm9Po5mVNox47rXHFgwvZgZ+S1+n4h8W92m/FpY8XP0QVXh ySncNipQ4J0UBOLqwLhVUaWudX9btYHMftRVRbaKy6VwISjZLGvaedUgvm1NW66duDtm BeWclQx/E32cBO/QFjlQIJw6LkNJ75KNpHyzpEAA5KgLmdt99CK3/0YhK00n7kfNYwQ/ sRMfbBVTqUlza/IsbgxmE2hog29sxq5FH4XDIE1v4/2Ro0RHFtdEkSW3j8aI//MQmskZ FZJN09b+zNwThslJc8p/EuATvsZh6VJ9SUBz1nzeaJ/U3MsjCVzWvIXVQ1lpAuIJimEt bh0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YOWYOcPv; 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 e14-20020a17090301ce00b00163b98f6047si11416777plh.116.2022.06.13.06.11.58; Mon, 13 Jun 2022 06:12:13 -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=YOWYOcPv; 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 S1355904AbiFMLm3 (ORCPT + 99 others); Mon, 13 Jun 2022 07:42:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354370AbiFMLey (ORCPT ); Mon, 13 Jun 2022 07:34:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E87A92BB0D; Mon, 13 Jun 2022 03:47:54 -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 210B66128D; Mon, 13 Jun 2022 10:47:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 273CCC34114; Mon, 13 Jun 2022 10:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117273; bh=xYguE/XfmdoYxmWbETkW9BQmAl4KULJOAlb+dWTpRSc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YOWYOcPvSorNzMxQdxXPz3Pl/NuYYgFCmcvHfV4FDmPGC50ktpWUr/hF+VYyeMqSN wTb2UxIt6PXW+lKzfuYmjTEnqNoTcAh6zVqwR0g2d3PstPOmWpram2RfytCykH6R4e 0jselODAdAPNflgEU9OLyRDM0azOGSKiitGGvqOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Helge Deller , Sasha Levin Subject: [PATCH 5.4 346/411] video: fbdev: pxa3xx-gcu: release the resources correctly in pxa3xx_gcu_probe/remove() Date: Mon, 13 Jun 2022 12:10:19 +0200 Message-Id: <20220613094939.084460517@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@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=-8.3 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: Yang Yingliang [ Upstream commit d87ad457f7e1b8d2492ca5b1531eb35030a1cc8f ] In pxa3xx_gcu_probe(), the sequence of error lable is wrong, it will leads some resource leaked, so adjust the sequence to handle the error correctly, and if pxa3xx_gcu_add_buffer() fails, pxa3xx_gcu_free_buffers() need be called. In pxa3xx_gcu_remove(), add missing clk_disable_unpreprare(). Signed-off-by: Yang Yingliang Signed-off-by: Helge Deller Signed-off-by: Sasha Levin --- drivers/video/fbdev/pxa3xx-gcu.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/video/fbdev/pxa3xx-gcu.c b/drivers/video/fbdev/pxa3xx-gcu.c index 74ffb446e00c..7c4694d70dac 100644 --- a/drivers/video/fbdev/pxa3xx-gcu.c +++ b/drivers/video/fbdev/pxa3xx-gcu.c @@ -651,6 +651,7 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) for (i = 0; i < 8; i++) { ret = pxa3xx_gcu_add_buffer(dev, priv); if (ret) { + pxa3xx_gcu_free_buffers(dev, priv); dev_err(dev, "failed to allocate DMA memory\n"); goto err_disable_clk; } @@ -667,15 +668,15 @@ static int pxa3xx_gcu_probe(struct platform_device *pdev) SHARED_SIZE, irq); return 0; -err_free_dma: - dma_free_coherent(dev, SHARED_SIZE, - priv->shared, priv->shared_phys); +err_disable_clk: + clk_disable_unprepare(priv->clk); err_misc_deregister: misc_deregister(&priv->misc_dev); -err_disable_clk: - clk_disable_unprepare(priv->clk); +err_free_dma: + dma_free_coherent(dev, SHARED_SIZE, + priv->shared, priv->shared_phys); return ret; } @@ -688,6 +689,7 @@ static int pxa3xx_gcu_remove(struct platform_device *pdev) pxa3xx_gcu_wait_idle(priv); misc_deregister(&priv->misc_dev); dma_free_coherent(dev, SHARED_SIZE, priv->shared, priv->shared_phys); + clk_disable_unprepare(priv->clk); pxa3xx_gcu_free_buffers(dev, priv); return 0; -- 2.35.1