Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1244519pxb; Tue, 29 Mar 2022 21:50:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOY693nMMDz0B48L4Fr2sAsO1nTCq5R4TovG9ns8U7s/RD8KA1/zXPvvJWyKb4ZUNX594F X-Received: by 2002:a17:906:4fc8:b0:6d8:5059:f998 with SMTP id i8-20020a1709064fc800b006d85059f998mr38834078ejw.487.1648615821911; Tue, 29 Mar 2022 21:50:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648615821; cv=none; d=google.com; s=arc-20160816; b=WIjnFOY4iSWOFubdi6xT47su4INC5CixQWTfFct4/F/EXKwEYBUGuVO8Ekf0I4985D HIsQNPoOSRvpsQRoScbcSVOa1viquh6chfQrIjQNETpFFO3B60U0pfdxYcVjNAJt5rhX UN7FEi2vdrUumXZyn2FRoPeFOre2oPc0yOYHoe1O9yQKpbGX0xzoermQIekQQja5s1Lg ymydezdAi7yGrTaDF0WTUq0pUlW01LE7EpkUjY+WRMA+Z3MRPzzsz+nCHLszpAM7/iW6 aa3zT+MCV+OtMclo2SFx6OP023fr5jvv7p7uhwNcODHMyjUPKhmgVgyQ8Yk4F7oRUZDF hr/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=3inDH5aNoJSb3kdo/G0d0grV2UWSLfx7sr9WdS9NZy8=; b=KJ3WOVZ+3nPf7RiB2ZoJblZ8ouj0AhZaKQSp29MRucY/SW+CK0TcGTy08A0N5dV3OH EdaE+iC8G0cDl40EHQYWzvPj/5/GpnN85W3LkU411SxuHZzCU+1q7aLAqr4F2FWFGDjv MWou7+lklfMy4zs2PnhiV8hFM2Bttcgfe8INxAY4w9iN2FOzbFz3FIRHMJRfqnGaPMyG 2X1EzPmD0BKNf8hpdx0N6AvHBncPkt7fu/iRhzMt7u28ByGjr6yCyaN/rEF5kx+TNuik vyodY2mxbkDjxGkJgM0EjGIApksSn9qn7vJSqQu4XmxfBrWk7qU0WKOp3YlFuDjcIIDw Zj6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a508dc9000000b00418c2b5bdb2si19294547edh.148.2022.03.29.21.49.45; Tue, 29 Mar 2022 21:50:21 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239800AbiC2Qnz convert rfc822-to-8bit (ORCPT + 99 others); Tue, 29 Mar 2022 12:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239761AbiC2QnY (ORCPT ); Tue, 29 Mar 2022 12:43:24 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 782A424EDB0 for ; Tue, 29 Mar 2022 09:41:38 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZEuV-0005rU-3T; Tue, 29 Mar 2022 18:41:35 +0200 Received: from [2a0a:edc0:0:900:1d::4e] (helo=lupine) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1nZEuR-003pAt-Jj; Tue, 29 Mar 2022 18:41:34 +0200 Received: from pza by lupine with local (Exim 4.94.2) (envelope-from ) id 1nZEuT-000Ale-Jy; Tue, 29 Mar 2022 18:41:33 +0200 Message-ID: <933830e163f5f514a24e8b6137c0ff2e4c89e7e5.camel@pengutronix.de> Subject: Re: [PATCH] drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe From: Philipp Zabel To: Liu Ying , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Date: Tue, 29 Mar 2022 18:41:33 +0200 In-Reply-To: <20220128091944.3831256-1-victor.liu@nxp.com> References: <20220128091944.3831256-1-victor.liu@nxp.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 On Fr, 2022-01-28 at 17:19 +0800, Liu Ying wrote: > In dw_hdmi_imx_probe(), if error happens after dw_hdmi_probe() > returns > successfully, dw_hdmi_remove() should be called where necessary as > bailout. > > Fixes: c805ec7eb210 ("drm/imx: dw_hdmi-imx: move initialization into > probe") > Cc: Philipp Zabel > Cc: David Airlie > Cc: Daniel Vetter > Cc: Shawn Guo > Cc: Sascha Hauer > Cc: Pengutronix Kernel Team > Cc: Fabio Estevam > Cc: NXP Linux Team > Signed-off-by: Liu Ying > --- >  drivers/gpu/drm/imx/dw_hdmi-imx.c | 8 +++++++- >  1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/imx/dw_hdmi-imx.c > b/drivers/gpu/drm/imx/dw_hdmi-imx.c > index 87428fb23d9f..a2277a0d6d06 100644 > --- a/drivers/gpu/drm/imx/dw_hdmi-imx.c > +++ b/drivers/gpu/drm/imx/dw_hdmi-imx.c > @@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct > platform_device *pdev) >         struct device_node *np = pdev->dev.of_node; >         const struct of_device_id *match = > of_match_node(dw_hdmi_imx_dt_ids, np); >         struct imx_hdmi *hdmi; > +       int ret; >   >         hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL); >         if (!hdmi) > @@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct > platform_device *pdev) >         hdmi->bridge = of_drm_find_bridge(np); >         if (!hdmi->bridge) { >                 dev_err(hdmi->dev, "Unable to find bridge\n"); > +               dw_hdmi_remove(hdmi->hdmi); >                 return -ENODEV; >         } >   > -       return component_add(&pdev->dev, &dw_hdmi_imx_ops); > +       ret = component_add(&pdev->dev, &dw_hdmi_imx_ops); > +       if (ret) > +               dw_hdmi_remove(hdmi->hdmi); > + > +       return ret; >  } >   >  static int dw_hdmi_imx_remove(struct platform_device *pdev) Thank you, applied to imx-drm/fixes. regards Philipp