Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2538926pxk; Mon, 14 Sep 2020 16:47:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlUML2hYwmb84+3dgA2nWfz+xohIIJzIaY/1BAAg/gd2+WONyxSH479B5JwsaBkcBQHBnR X-Received: by 2002:aa7:c38a:: with SMTP id k10mr20127879edq.325.1600127243855; Mon, 14 Sep 2020 16:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600127243; cv=none; d=google.com; s=arc-20160816; b=y3vRaImPw1JBeoBS03NXBOznA+fjqRe2z18aKN6R452kpPxgJ2k/0rFWLMA6i/T9oe LrYUX3kzWxiNVkTRlebGCp0w4bdyNDUOtn04RgeAwGYLgwTTvhT8CS/cUUPtAJgBP7d7 b0dymU/6VTlWYvylFgPV92f4K/SvjylNj9tmoU/goQnc1jht1CwgUAuExmoM3vd+Q442 R05FBhadvcv/PENX3W/+HjA7RE9O0MgoA9c+fA0HOczHRwn6ksOA4lqW/s0HZ9AGV8P6 SNMfLaFoRZo2OknAx8Mc6xgvZMzZ9+gx7OYeQ5pNQ7wx3pe5mAX38yzqbrvqVBDeBIKy Iybg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=OHnoFfOF76LE0GnL3vON5hU+uyock0ix6GmrMbNwptk=; b=0+luaAYI3uFFDEXEht4kw+KPTZDKBbalrCKoWKiGEijal/Vda1PsU8ti0Tf5P5vDdg bjQnW1pv8IDZ1ZtqgRQAD4bpncCqDo7BuxnMJfYQ4B6js0vXFnk+Y8bEsURPKMff83Fp HmcAlQJYmiZLa52B1s9oyDvL9p+2rkr7X9BRwJPTxizcjwWFw6+FS9eAd49ETlJkr6gb nKQoPeEkddM2qmLEYbW+CO85TSeC0tJKfA4p9XMON9acHhVQ3BlksE7nBClcyOhB1rgo IoqHIvX5IUTjB/wBVA498tuU6yc2k4x5hiQyQ1vbSPAKakdw9WetWu1e8SJGBBSiflh2 4DdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tldsgMhM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si8926101edc.174.2020.09.14.16.47.01; Mon, 14 Sep 2020 16:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tldsgMhM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726045AbgINXoR (ORCPT + 99 others); Mon, 14 Sep 2020 19:44:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:45556 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgINXoQ (ORCPT ); Mon, 14 Sep 2020 19:44:16 -0400 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5654321741 for ; Mon, 14 Sep 2020 23:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600127055; bh=+OhI6QNHCUTezEy3dC8zYNoj1C1U2IUoG/B2Kdfhl0Y=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tldsgMhMqLV/lzvk9W8V5/yK35Olz+LfV3L7KOMtcrLzTTSw9fIEELANJodDHRdQD B2T06DyfTxiJHGrZBjdCQxk84dzjB+FaMfaCJZXZ86nBGTk2e53cS8NF4dcy4+EixH rkXN5fe+bf0vsl7ZMkLPt9XaQOHrlWvtn5Lg5UjE= Received: by mail-ej1-f43.google.com with SMTP id j11so2448065ejk.0 for ; Mon, 14 Sep 2020 16:44:15 -0700 (PDT) X-Gm-Message-State: AOAM530fltDM4saGtPeBRip9PJaih86Yo4/ZLnnanEnSIJH2476c3e85 apJaEj735j8lybvlfOaLEBpaRRZiFkdQW99wSQ== X-Received: by 2002:a17:906:8690:: with SMTP id g16mr16850817ejx.187.1600127053936; Mon, 14 Sep 2020 16:44:13 -0700 (PDT) MIME-Version: 1.0 References: <20200911112151.3220469-1-yukuai3@huawei.com> In-Reply-To: <20200911112151.3220469-1-yukuai3@huawei.com> From: Chun-Kuang Hu Date: Tue, 15 Sep 2020 07:44:03 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/mediatek: add missing put_device() call in mtk_hdmi_dt_parse_pdata() To: Yu Kuai Cc: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , jie.qiu@mediatek.com, junzhi.zhao@mediatek.com, DRI Development , Linux ARM , "moderated list:ARM/Mediatek SoC support" , linux-kernel , yi.zhang@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yu Kuai: Yu Kuai =E6=96=BC 2020=E5=B9=B49=E6=9C=8811=E6=97=A5 = =E9=80=B1=E4=BA=94 =E4=B8=8B=E5=8D=887:22=E5=AF=AB=E9=81=93=EF=BC=9A > > if of_find_device_by_node() succeed, mtk_drm_kms_init() doesn't have > a corresponding put_device(). Thus add jump target to fix the exception > handling for this function implementation. Reviewed-by: Chun-Kuang Hu > > Fixes: 8f83f26891e1 ("drm/mediatek: Add HDMI support") > Signed-off-by: Yu Kuai > --- > drivers/gpu/drm/mediatek/mtk_hdmi.c | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediat= ek/mtk_hdmi.c > index f2e9b429960b..a97725680d4e 100644 > --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c > +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c > @@ -1507,25 +1507,30 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdm= i *hdmi, > dev_err(dev, > "Failed to get system configuration registers: %d= \n", > ret); > - return ret; > + goto put_device; > } > hdmi->sys_regmap =3D regmap; > > mem =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); > hdmi->regs =3D devm_ioremap_resource(dev, mem); > - if (IS_ERR(hdmi->regs)) > - return PTR_ERR(hdmi->regs); > + if (IS_ERR(hdmi->regs)) { > + ret =3D PTR_ERR(hdmi->regs); > + goto put_device; > + } > > remote =3D of_graph_get_remote_node(np, 1, 0); > - if (!remote) > - return -EINVAL; > + if (!remote) { > + ret =3D -EINVAL; > + goto put_device; > + } > > if (!of_device_is_compatible(remote, "hdmi-connector")) { > hdmi->next_bridge =3D of_drm_find_bridge(remote); > if (!hdmi->next_bridge) { > dev_err(dev, "Waiting for external bridge\n"); > of_node_put(remote); > - return -EPROBE_DEFER; > + ret =3D -EPROBE_DEFER; > + goto put_device; > } > } > > @@ -1534,7 +1539,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi = *hdmi, > dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n", > remote); > of_node_put(remote); > - return -EINVAL; > + ret =3D -EINVAL; > + goto put_device; > } > of_node_put(remote); > > @@ -1542,10 +1548,14 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdm= i *hdmi, > of_node_put(i2c_np); > if (!hdmi->ddc_adpt) { > dev_err(dev, "Failed to get ddc i2c adapter by node\n"); > - return -EINVAL; > + ret =3D -EINVAL; > + goto put_device; > } > > return 0; > +put_device: > + put_device(hdmi->cec_dev); > + return ret; > } > > /* > -- > 2.25.4 >