Received: by 10.223.185.116 with SMTP id b49csp1118946wrg; Sat, 3 Mar 2018 16:07:53 -0800 (PST) X-Google-Smtp-Source: AG47ELsV+HNFqNcs19nmkjz/Irsl8Xho+bqc5lwYyLGazVTWR+mOdL0xi2S9vTv3UnAVUNc1nvcv X-Received: by 2002:a17:902:9306:: with SMTP id bc6-v6mr8908483plb.29.1520122073384; Sat, 03 Mar 2018 16:07:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520122073; cv=none; d=google.com; s=arc-20160816; b=OxlJQBYpIznxEaXmx5wWrCvg3cnzlVeYzRHS0gRS2KNGIzmgFdn80TeG3rmLlXLLAN xBWCNiBWjyYAyVNpw4XqUphj/JVBV7GK4XvOqJVYfYJ/x13j3LCGcJUpC+I5SdIfTf/8 OPhNvoZZlG5yD5gZerBnn/nVANUNJEO3pYPvpWVTAAKXbVrSj2+DstddVwpjqQkg0kRd 2VgijzYQqdHDyJyAU3X8pEDXRDxqoMbHi12EbUemOCuj0/4jfDUNXdT384XrhVSdchXa w5cIoQuoVPFWtgMJ0o4twgOrUvlqxPcYrxEYTfAsg66mGYX7R4A/UwS2TWoKB/C5XpdP wNpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=HXTVvVPoE8IxDb4eDzwTU4efPz28NDDCNHd4b9SntIk=; b=yulx1dEPcnzzoAuI7io+fBpoGSC2OK/uQ6C+Uk0v7LjeXUDHpUl7nP2R6Ktea2b7WR GrMPYteGSaN3a1t7L/xAC/7vFreG5VCeel/feExg7cZphWWa20CGagkIVRyDrg5a8fju OE7lLUo4xsD2ZM8k2GgLGiuqQd6SZC5tBD7BMx2YGh9q7T3mm/1Fk87FeKVe17E9Zj+M BQeyLNTkp0gEUtkSQmklh3tVdV2rhSHKF0POkge4kwNETFL4HATSJBXUGph6E38FXK5d VHAFmcLihgZ8wBZ3/TpqHWLU5J9SYTXxuxA9jpIUqO4JaQ8z00ne4n8Knncn0noHVDZp b1yQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZVcbvXsz; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u29si6169548pgn.770.2018.03.03.16.07.39; Sat, 03 Mar 2018 16:07:53 -0800 (PST) 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; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=ZVcbvXsz; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932772AbeCDAHG (ORCPT + 99 others); Sat, 3 Mar 2018 19:07:06 -0500 Received: from mail-bn3nam01on0111.outbound.protection.outlook.com ([104.47.33.111]:54931 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933386AbeCCWbM (ORCPT ); Sat, 3 Mar 2018 17:31:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HXTVvVPoE8IxDb4eDzwTU4efPz28NDDCNHd4b9SntIk=; b=ZVcbvXszIlLgb6/5xY1gT7eU2wkbNq/3lu2XS9K+vCykKf8kzOCBqyI5Daun48nBjN1BYV8Hjf82oyhGfYKOMfqPE94gadUMqUUZRgfuwJ+bwpt91t1AT9CXf9ataxgCPBhBP3xrMsDz5sHRGIZvGY3RHoV51BRtdZsJI+e7uJU= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB0970.namprd21.prod.outlook.com (52.132.146.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.3; Sat, 3 Mar 2018 22:31:06 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:31:06 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Chen-Yu Tsai , Maxime Ripard , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 015/219] drm/sun4i: Fix up error path cleanup for master bind function Thread-Topic: [PATCH AUTOSEL for 4.9 015/219] drm/sun4i: Fix up error path cleanup for master bind function Thread-Index: AQHTsz7lsadMh7nm7EeMT+iJjI3MYQ== Date: Sat, 3 Mar 2018 22:28:04 +0000 Message-ID: <20180303222716.26640-15-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB0970;7:31NUcRSsD2JFqyP9uLmt7HrmjUYyvj6+ka4rkUcDZcoNZ1RhUEs/Abgf5o3IOw8lvHT0KXhL4Ay0epuFYjOF+GD+ENe1DxkRAPMcggW6I/IeTIVXiftihNGbe9IR7h8t29DjXA0wV6LUjp9ieANTqPv7o2JQAPqXfmdZ45evth2GEZCSFTjpEPe49QwCIlZSPfWXD8OdQYRFKUaLdjs1TG9HB9D2q5hYxVcvyXZ3NghncMIAnfBp4aXZDHSb5xY8 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 2e47da35-dceb-4306-fb80-08d581567475 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB0970; x-ms-traffictypediagnostic: MW2PR2101MB0970: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171)(58145275503218); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201703061421075)(201703161042150)(6072148)(6042181)(201708071742011);SRVR:MW2PR2101MB0970;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB0970; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(199004)(189003)(575784001)(86362001)(110136005)(4326008)(6506007)(14454004)(99286004)(8936002)(1076002)(36756003)(2906002)(102836004)(76176011)(25786009)(6486002)(498600001)(3280700002)(107886003)(186003)(54906003)(26005)(81166006)(7736002)(8676002)(6512007)(81156014)(305945005)(72206003)(6436002)(53936002)(6116002)(86612001)(68736007)(3846002)(2950100002)(3660700001)(10290500003)(22452003)(10090500001)(2900100001)(106356001)(2501003)(66066001)(97736004)(5660300001)(5250100002)(105586002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB0970;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: FEV5LVBEvWYftyVNMAkJmMWpin0ynmIr1msVm/kN21G56eW+CLrkf5PXKpK0Yj43fSNqmyVqSAlrBLVvIEvUjqEH1AU+WakAvBff2yJWchXbpn2AY/hrbXtITDV/omPed3foYE16PKq+/uyUo/1praGxvBNGkWwFQ2PFjh6YO6w= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e47da35-dceb-4306-fb80-08d581567475 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:04.1818 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB0970 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/gpu/drm/sun4i/sun4i_drv.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4= i_drv.c index 1feec34ca9dd..9e77fc034e0a 100644 --- 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 *dev) ret =3D 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; } =20 /* Create our layers */ @@ -153,7 +153,7 @@ static int sun4i_drv_bind(struct device *dev) if (IS_ERR(drv->layers)) { dev_err(drm->dev, "Couldn't create the planes\n"); ret =3D PTR_ERR(drv->layers); - goto free_drm; + goto cleanup_mode_config; } =20 /* Create our CRTC */ @@ -161,7 +161,7 @@ static int sun4i_drv_bind(struct device *dev) if (!drv->crtc) { dev_err(drm->dev, "Couldn't create the CRTC\n"); ret =3D -EINVAL; - goto free_drm; + goto cleanup_mode_config; } drm->irq_enabled =3D true; =20 @@ -173,7 +173,7 @@ static int sun4i_drv_bind(struct device *dev) if (IS_ERR(drv->fbdev)) { dev_err(drm->dev, "Couldn't create our framebuffer\n"); ret =3D PTR_ERR(drv->fbdev); - goto free_drm; + goto cleanup_mode_config; } =20 /* Enable connectors polling */ @@ -181,10 +181,16 @@ static int sun4i_drv_bind(struct device *dev) =20 ret =3D drm_dev_register(drm, 0); if (ret) - goto free_drm; + goto finish_poll; =20 return 0; =20 +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; --=20 2.14.1