Received: by 10.213.65.68 with SMTP id h4csp10986imn; Mon, 19 Mar 2018 17:48:37 -0700 (PDT) X-Google-Smtp-Source: AG47ELukW4betEBCpB5LtXKOfFo7mhsj21s0HPNtxdhlbRirCiw7ppGcZui59ekUKwov8+nvocDp X-Received: by 10.99.172.10 with SMTP id v10mr10570973pge.341.1521506917247; Mon, 19 Mar 2018 17:48:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521506917; cv=none; d=google.com; s=arc-20160816; b=w64IkMWwMdSphdHrZKbO77qtCFvRu7giUQR4ho1kEyI9xwUoe+AMlw97dogrRIhPpi O9suzMlVcKqdeHiOpLTwg03z2G9WsaL3t/68d5U17Zg2SS5Fj8RW7wh6wHkYH4vrjqOX bWRB8gI/6grQcRBUiPOqmkboDBS0F5xvKrxi53KxThmP/7Dt94rTbeD5bxyvvj9tTyMM fM69WIvucuiDqHiXosuFPO5bXPEGSxae70F56UVU4NYG8dnQyIAu1ybLQ3Ff+LR2GpSs bYCrZsfcIIknVI/bjaughPQ27NHQQ8pOZWSBo4CN2L8Vg8dnHNbu7z8wQxLuzcyiI71o Y2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=l4yLsLIHYJGNN9rUL+CgZduOb3Ww511U2c/uPRkvX6g=; b=I6PNVq+n4tW8PaWUX8N/YN2PzAPnr9T2Pj4hFSkjcFyPwvqgKQBTImXVENSwlvqcfX C09ELAwYkO6XIH796kZZIAU7YGbxPdYpZA3j0oHuH2CAOclYRyjn2dz966CT0AP6W4X0 yCIphtSli/ahyeFWns2pqvuo6POYeDhMTYJoPqsJ49WZKVU0QUqNucKnSXJ2Ra+nByRf AD6zZYZUe7iyarNGxuBD5R25RYOcNOfC+GkDyVCI4G2lvxxqLDGnxD8nYqkHVLHhKVs/ 06FAUk1mQAiMHVDBlrP6OAU32Eei9+Emai5YqbglzJkQbu70JkRO05uhZssJDdakrPxg k0FQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k73si289621pgc.707.2018.03.19.17.48.11; Mon, 19 Mar 2018 17:48:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969316AbeCSSS1 (ORCPT + 99 others); Mon, 19 Mar 2018 14:18:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46002 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969305AbeCSSSX (ORCPT ); Mon, 19 Mar 2018 14:18:23 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 21A012F; Mon, 19 Mar 2018 18:18:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Sasha Levin Subject: [PATCH 4.9 013/241] drm/sun4i: Fix up error path cleanup for master bind function Date: Mon, 19 Mar 2018 19:04:38 +0100 Message-Id: <20180319180751.722463516@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chen-Yu Tsai [ Upstream commit 9d56defb44b15427f4342c543a70fb7886fc06f5 ] The master bind function calls numerous drm functions which initialize underlying structures. It also tries to bind the various components of the display pipeline, some of which may add additional drm objects. This patch adds proper cleanup functions in the error path of the master bind function. This requires the patch "drm/sun4i: Move drm_mode_config_cleanup call to main driver", which splits out drm_mode_config_cleanup from sun4i_framebuffer_free so we can call it separately. Signed-off-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/sun4i/sun4i_drv.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/sun4i/sun4i_drv.c +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c @@ -145,7 +145,7 @@ static int sun4i_drv_bind(struct device ret = component_bind_all(drm->dev, drm); if (ret) { dev_err(drm->dev, "Couldn't bind all pipelines components\n"); - goto free_drm; + goto cleanup_mode_config; } /* Create our layers */ @@ -153,7 +153,7 @@ static int sun4i_drv_bind(struct device if (IS_ERR(drv->layers)) { dev_err(drm->dev, "Couldn't create the planes\n"); ret = PTR_ERR(drv->layers); - goto free_drm; + goto cleanup_mode_config; } /* Create our CRTC */ @@ -161,7 +161,7 @@ static int sun4i_drv_bind(struct device if (!drv->crtc) { dev_err(drm->dev, "Couldn't create the CRTC\n"); ret = -EINVAL; - goto free_drm; + goto cleanup_mode_config; } drm->irq_enabled = true; @@ -173,7 +173,7 @@ static int sun4i_drv_bind(struct device if (IS_ERR(drv->fbdev)) { dev_err(drm->dev, "Couldn't create our framebuffer\n"); ret = PTR_ERR(drv->fbdev); - goto free_drm; + goto cleanup_mode_config; } /* Enable connectors polling */ @@ -181,10 +181,16 @@ static int sun4i_drv_bind(struct device ret = drm_dev_register(drm, 0); if (ret) - goto free_drm; + goto finish_poll; return 0; +finish_poll: + drm_kms_helper_poll_fini(drm); + sun4i_framebuffer_free(drm); +cleanup_mode_config: + drm_mode_config_cleanup(drm); + drm_vblank_cleanup(drm); free_drm: drm_dev_unref(drm); return ret;