Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3088039rwb; Mon, 15 Aug 2022 17:50:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR6/Am19Dq5yvQYVZOF2jbuHRI1ISbqEsoHQS7Wtg+R2I/be5E0kbku2W9TCB87XnijfARR+ X-Received: by 2002:a17:907:9483:b0:731:2be4:f73c with SMTP id dm3-20020a170907948300b007312be4f73cmr12468419ejc.380.1660611015674; Mon, 15 Aug 2022 17:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611015; cv=none; d=google.com; s=arc-20160816; b=b8osl+r4g4hKhVAz7Q7yIoOT49gcESvVvSl6BcIAXhw8JSR494OQ3ds3WiV+aKvOhX xY06ufw4IuUO7vgWtb4dfF1lPYyqyH4Sfkzt/73KSisPDxMqVyDOkJcSgIYcU5DPSt8y uUOOAvynkwtGrxbz2vu0ax2+Sto2q2PflBkp5Cz5uJp/fAz3PB7YE+Z/3ihjr/z+Xg4N rkCDhRtm1MO90cBiJtwgW1mYrH4y5FQGWRBhyOa1nhfDYfNE18Eswr2KL1qAmC4IGLHp NouLPI85AH2NQM4ObRQe7/cmAMaMu2KakPbkg3ECkmxTzfdw/ibPYzkO5s6564/Y6Qfp M2Kg== 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=XdzRxLadKo5o7nojXAaI0m1ow84CmU8cnASEdITgsMw=; b=btz/9mu+Xgw+7OrOBVhbX3HyINLflu94ZE5wIRDhEDcJVfR8+qsYuMBK7JD6z71VPU Jez3Pg2SrExDM9KCKMdc+8Z7Xy+rsKsTnEOk9+ST/REq9ucHs8UA+J17EXglZOH0EDEE hGxo3w8YgsXpM/01kb2ZjzF6p/EquHIWDJPeQgHMheLYGnVd3ss/t2si7nVp9r/IsYmR fZ5MEm8QHL+tb22j7ULR+f0EB914Mc4bnvJMa1VsWSAj6ULHC1MjncafHIsEOsj7neQl LCvlss9m0po1RjyEaG+7RMED5Z7aWyBcxdWdmGShHc4FX9Eeh4tUPMtJzNY9YY8yQohx rj+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Dq/Jmeaq"; 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 md17-20020a170906ae9100b00730d33c8fb3si8207355ejb.49.2022.08.15.17.49.50; Mon, 15 Aug 2022 17:50:15 -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="Dq/Jmeaq"; 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 S1344166AbiHOX0L (ORCPT + 99 others); Mon, 15 Aug 2022 19:26:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346627AbiHOXVj (ORCPT ); Mon, 15 Aug 2022 19:21:39 -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 3F5A87E305; Mon, 15 Aug 2022 13:04:39 -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 615DBB80EA8; Mon, 15 Aug 2022 20:04:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9476C433C1; Mon, 15 Aug 2022 20:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660593877; bh=hP/9KZye9mvWkD+qnzNh7Mn9ujOi/BfJgmHbNS6xy7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dq/JmeaqkWtarQzuNxI4nkjKmDFmE3bWq8XESEyPPUdSN6uiskvqu7kNi4eiGncep cM28E52ljwHSIwKY/WKSLhtPqPFQ5mSnf/ItlelmaTx2G1zRDTTq6c3fEVCc8cGWad 1g+nIxZZW96WPqS0IXBAQLaNpJKo5eza2+8qoyNI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.19 0311/1157] drm/meson: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:54:27 +0200 Message-Id: <20220815180452.097271850@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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: Miaoqian Lin [ Upstream commit 7381076809586528e2a812a709e2758916318a99 ] of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Add missing put_device() in error path to avoid refcount leak. Fixes: 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220511054052.51981-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/meson/meson_encoder_hdmi.c index 5e306de6f485..de87f02cd388 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -435,8 +435,10 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) cec_fill_conn_info_from_drm(&conn_info, meson_encoder_hdmi->connector); notifier = cec_notifier_conn_register(&pdev->dev, NULL, &conn_info); - if (!notifier) + if (!notifier) { + put_device(&pdev->dev); return -ENOMEM; + } meson_encoder_hdmi->cec_notifier = notifier; } -- 2.35.1