Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3036002pxp; Mon, 14 Mar 2022 09:32:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEgtjmPFGzYo2QjO7zXHIor7hSf8/g/HRV+zAcWXXgcxyA66sSTfjBmNcoOcYlMQH2qED2 X-Received: by 2002:a17:90a:578f:b0:1b9:b03f:c33c with SMTP id g15-20020a17090a578f00b001b9b03fc33cmr79268pji.114.1647275556635; Mon, 14 Mar 2022 09:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647275556; cv=none; d=google.com; s=arc-20160816; b=oAs8BbyccME2qVgDYS4mLmV8vEq9/qxWhZSuKWUgUXSkvNN+L4boJZIfIwITSfmE5o lpJNfv0iic2IjOUAh2AGCPFC+bxZunAVD8/72ExaPdyOoLrvvzfNBrCgBaa+q9PJu0A6 axdAuUUXzv3WtNt9dyYVZ6qKng0kh5FMtTZeUHKzVWbUjvF/lBo8KMH+8WCCkcEbPSEo BPm319VB2kLBisFtzLb0ToxQz0wbtJLTZrn7K4zjFglcq02RhlJS/woFAaedbxsye2yT 53h3CG0bAN1Ap56Um5QLrawZV4NYl910aRQmre9usBxFoRNHHHW/Nke0vNhzaWgPBTIR Rt1w== 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=FPRB8xujhsq2VBb+BSP01mYKbAa2pT6gG//bSYkK4fQ=; b=KHFTdcP3+/Pg9WXd9j6wCgNesSedgev42QbaScgZxO5VGekJyMhtQ2K4zIi8d27gyJ r9cbqpukVv7lDdM5UjjW22xsL75fwhvQ3FR5HCSEOijG0cxieddN89MbiCWzfl0Gg5tE eSq8rlSTCds6Xy4+eDlJ+/klWlxX6JS4w7asr0gGRjV8AZRymc3dTWIOaJ3SPaMHSeeM 4UZ87kKIW7jy3nEzsDqr2F5mngr9tF73hD9hqYktIEqA9ZdYZSqdv63mYjmS/BYNCn4i g98fTCiVIc7CHWlom51mGdNPt3aUeZNALzMgh1mnC86uXsPGZcqz1lD26NRO21yAhT4u i99Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FiGGh8G7; 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 e1-20020a170902744100b00153349cd289si9036194plt.527.2022.03.14.09.32.22; Mon, 14 Mar 2022 09:32:36 -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=FiGGh8G7; 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 S245252AbiCNMcw (ORCPT + 99 others); Mon, 14 Mar 2022 08:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243920AbiCNMVX (ORCPT ); Mon, 14 Mar 2022 08:21:23 -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 5E57213CD3; Mon, 14 Mar 2022 05:18:17 -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 DA14E60919; Mon, 14 Mar 2022 12:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDD15C340E9; Mon, 14 Mar 2022 12:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647260296; bh=LmRga0VTamUUd5o95CfD1gCQkfP8wH4YTTwDMJR8llk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FiGGh8G79/CToXPqdVJDig+HLzfxfGxQyqvV//WKVkAxANYEXcqN0rA25tU1ernhG fmoIsLMPlbOmfeum5fbHOx5rBdVofVhWy1pfQD+4xB18PfmpotsBFaNe4CWLu9RGXL uGOUnnJJ36PwtIgM86p0tHDfYvK4pjrfQNdtdTFU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Javier Martinez Canillas , Sasha Levin Subject: [PATCH 5.16 068/121] drm/vc4: hdmi: Unregister codec device on unbind Date: Mon, 14 Mar 2022 12:54:11 +0100 Message-Id: <20220314112746.022924338@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112744.120491875@linuxfoundation.org> References: <20220314112744.120491875@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.6 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: Maxime Ripard [ Upstream commit e40945ab7c7f966d0c37b7bd7b0596497dfe228d ] On bind we will register the HDMI codec device but we don't unregister it on unbind, leading to a device leakage. Unregister our device at unbind. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20220127111452.222002-1-maxime@cerno.tech Signed-off-by: Sasha Levin --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++ drivers/gpu/drm/vc4/vc4_hdmi.h | 1 + 2 files changed, 9 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 24f11c07bc3c..2f53ba54b81a 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1522,6 +1522,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) dev_err(dev, "Couldn't register the HDMI codec: %ld\n", PTR_ERR(codec_pdev)); return PTR_ERR(codec_pdev); } + vc4_hdmi->audio.codec_pdev = codec_pdev; dai_link->cpus = &vc4_hdmi->audio.cpu; dai_link->codecs = &vc4_hdmi->audio.codec; @@ -1561,6 +1562,12 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) } +static void vc4_hdmi_audio_exit(struct vc4_hdmi *vc4_hdmi) +{ + platform_device_unregister(vc4_hdmi->audio.codec_pdev); + vc4_hdmi->audio.codec_pdev = NULL; +} + static irqreturn_t vc4_hdmi_hpd_irq_thread(int irq, void *priv) { struct vc4_hdmi *vc4_hdmi = priv; @@ -2299,6 +2306,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, kfree(vc4_hdmi->hdmi_regset.regs); kfree(vc4_hdmi->hd_regset.regs); + vc4_hdmi_audio_exit(vc4_hdmi); vc4_hdmi_cec_exit(vc4_hdmi); vc4_hdmi_hotplug_exit(vc4_hdmi); vc4_hdmi_connector_destroy(&vc4_hdmi->connector); diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h index 33e9f665ab8e..c0492da73683 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h @@ -113,6 +113,7 @@ struct vc4_hdmi_audio { struct snd_soc_dai_link_component platform; struct snd_dmaengine_dai_dma_data dma_data; struct hdmi_audio_infoframe infoframe; + struct platform_device *codec_pdev; bool streaming; }; -- 2.34.1