Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp937803pxb; Wed, 6 Apr 2022 04:50:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH4aDgUjzJyXBrCc5dxNMscnCVwTvyHrFz7QHZQYQUOPrEFQQcnk2pfPF/1W3kpPJZFgSi X-Received: by 2002:a17:902:f64c:b0:156:7ceb:b579 with SMTP id m12-20020a170902f64c00b001567cebb579mr7922818plg.73.1649245823255; Wed, 06 Apr 2022 04:50:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245823; cv=none; d=google.com; s=arc-20160816; b=uIrWRlBUyqpeQXPa93jBnJ+G+5F31AkZ/db9Xgi1J1v4ydXLxg8VGgHrmLTgJkuZfn hJGK1QriVgw41no4LMA/V64qASlmnjTwPz8qRHBYUxQypCpYtQa4x41P4giTVSFBb9b2 Am0LdIVLAv0a7BF47e9ZxEHWm19oXvTZ43B3/RiB7xv/u1o75wKvLBGOmXIXRlHbG3vp Zx524QI4scCWji+7EtNlL7F5eNLADOuR9HZs4gNXTJ7UgLW+UMifCMIuUTxm4T1YJTvQ zVF+gXYAx+Nf9cGAcJlSBrs2ESYIuu/xCCDSR1z0rRPvGCtQtZ8qiChnxHXUD7sTPSnU eUVA== 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=T5djlIteb5ldUIRB5qyg4i7Z7lxaSHckKne5NM0nIEQ=; b=joUVl0VzJm3omwmkfrum54OlQvF5FgfFjcJazTdVwesfrv5Uq3IMULCeeBxcw18rdi vyhaLvCYwNe657iuySGvE7c4EpnRG0PKW2nZ8j1GXZvj7nfgBCdnm5llKEOkfb+RUILc ReauZq4tMXkFSwMgXMrTDg0akJacDD4N77riRWBESRCZC6OUJgYkc4+ZNE1k1SrJ9PLS Y+xL+2hkOtVa2gyFJEJk6iV5exJCNQ28xoLMJcMPxhIlbpeXWc2KJlvPlxMMCAQYx/dn V8yOEjzriqwUJifhClbUau3dJtiSTVbzjv/s3GFL2g3xxgSrMkT1M4vi2wpJFTrMk3XS CQEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=C7fo7jGY; 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 i36-20020a635864000000b00397ffaa5f06si15708820pgm.718.2022.04.06.04.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:50:23 -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=C7fo7jGY; 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 52114633A33; Wed, 6 Apr 2022 03:09:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1836364AbiDFAf6 (ORCPT + 99 others); Tue, 5 Apr 2022 20:35:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348913AbiDEJsq (ORCPT ); Tue, 5 Apr 2022 05:48:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F05EEE4E3; Tue, 5 Apr 2022 02:37:22 -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 2BC7E61368; Tue, 5 Apr 2022 09:37:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A529C385A2; Tue, 5 Apr 2022 09:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151441; bh=LVVgoah1FFD2uGXo9sEwOMtgTBJf1uME5I17THO9hX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C7fo7jGYUwGs3SCaon5/FsZ2tP6JJksma3POivtkP/XtweblnTEcOlFN0l+cuc7k7 lAuxuXCTRagJqKt6PLsg3epk8xclev0FXbtYH7wq1F9RISbAFpHYEGhJmi+mEUHj8e vsP4QA1YAv/aGmd863dv8vBzRd5+LilyGVlJu/FM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 377/913] drm/meson: Fix error handling when afbcd.ops->init fails Date: Tue, 5 Apr 2022 09:23:59 +0200 Message-Id: <20220405070351.148815841@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: Martin Blumenstingl [ Upstream commit fa747d75f65d1b1cbc3f4691fa67b695e8a399c8 ] When afbcd.ops->init fails we need to free the struct drm_device. Also all errors which come after afbcd.ops->init was successful need to exit the AFBCD, just like meson_drv_unbind() does. Fixes: d1b5e41e13a7e9 ("drm/meson: Add AFBCD module driver") Signed-off-by: Martin Blumenstingl Acked-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20211230235515.1627522-3-martin.blumenstingl@googlemail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_drv.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 45bfe9451db8..c98525d60df5 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -302,42 +302,42 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) if (priv->afbcd.ops) { ret = priv->afbcd.ops->init(priv); if (ret) - return ret; + goto free_drm; } /* Encoder Initialization */ ret = meson_venc_cvbs_create(priv); if (ret) - goto free_drm; + goto exit_afbcd; if (has_components) { ret = component_bind_all(drm->dev, drm); if (ret) { dev_err(drm->dev, "Couldn't bind all components\n"); - goto free_drm; + goto exit_afbcd; } } ret = meson_encoder_hdmi_init(priv); if (ret) - goto free_drm; + goto exit_afbcd; ret = meson_plane_create(priv); if (ret) - goto free_drm; + goto exit_afbcd; ret = meson_overlay_create(priv); if (ret) - goto free_drm; + goto exit_afbcd; ret = meson_crtc_create(priv); if (ret) - goto free_drm; + goto exit_afbcd; ret = request_irq(priv->vsync_irq, meson_irq, 0, drm->driver->name, drm); if (ret) - goto free_drm; + goto exit_afbcd; drm_mode_config_reset(drm); @@ -355,6 +355,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) uninstall_irq: free_irq(priv->vsync_irq, drm); +exit_afbcd: + if (priv->afbcd.ops) + priv->afbcd.ops->exit(priv); free_drm: drm_dev_put(drm); -- 2.34.1