Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp962721ybp; Fri, 4 Oct 2019 07:38:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ44y6W/jschGwuLGsroNzSLQWaurBv/32bJNgDexLXG389HI9oT6uM8ICuaCKubdH7kH9 X-Received: by 2002:a17:906:5bc1:: with SMTP id w1mr12655406ejs.143.1570199880027; Fri, 04 Oct 2019 07:38:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1570199880; cv=pass; d=google.com; s=arc-20160816; b=ko6q2McGm2cr9Y88bRv5N2hPZtaPjaNIceZFCMcBj7uuT6WxgHajzhSP5OFKinamH+ OGbXrhs/VqWwrxhDKkSh59QZWF/faQNqw64QxeXki0On6QkcYJ8VQeGFy6JOL03meZWU g6zDw2S1BBkVPYocvj6NEhBWLrz2cdb7i0y6/c8Qjaa0YpKEVY7G2SBTeZQZA5EFQBdG YGgWJGwJbHy9MrX8qXZmP6NkoEyYeHHeTGnAAeGRxVm2x0PORv0NXRf7Nvqm20KxDXpp YsX/3cHXyM9+kMxwooDr40zRIBXYKTo78DzbA9J38+iwjxzYRYkCPOTZCgz9R2q3TEBF CleA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:nodisclaimer :original-authentication-results:mime-version :content-transfer-encoding:authentication-results-original :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature :dkim-signature; bh=MK4ZcTaWUSRAjX0xe8+6lEgAOWI0bkyan77WyvE7Nwo=; b=er8SVyWEK2NLzluKgSql+mDYxaPLMAHtpnofkmjyPFtPvq4PyYz7LfT9G1233z9dcs qx51Mf6+AUoK4EQmoDIFvb36ghgkpvskBUWDCHiLihGVuRoNarBVX2hTBGD3i/+MMcPo S18y+rj1MytQpUyNiw6X/bGVjYQP0y/5Hgbe9MT9K8/SkkO3ku67ljTd3s4l78UmvDMg w+Oe6flrxn4A41iMv67Ov0ToJpW44siW4blk86Gysfnk7Fxj2vWAimPBILsdhDIUglvI WmeL3Rjxv0QceAkKAm7ZJAGDmFXnGVkVcR+UqsCewrXaAAWgqvm3Rgl72zfO+kzClNVY 0WzA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=PbGcC81U; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=PbGcC81U; arc=pass (i=1 spf=pass spfdomain=arm.com dkim=pass dkdomain=arm.com dmarc=pass fromdomain=arm.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 e48si4065758eda.130.2019.10.04.07.37.35; Fri, 04 Oct 2019 07:38:00 -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; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=PbGcC81U; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=PbGcC81U; arc=pass (i=1 spf=pass spfdomain=arm.com dkim=pass dkdomain=arm.com dmarc=pass fromdomain=arm.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 S2389207AbfJDOgj (ORCPT + 99 others); Fri, 4 Oct 2019 10:36:39 -0400 Received: from mail-eopbgr50043.outbound.protection.outlook.com ([40.107.5.43]:48850 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389043AbfJDOgj (ORCPT ); Fri, 4 Oct 2019 10:36:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MK4ZcTaWUSRAjX0xe8+6lEgAOWI0bkyan77WyvE7Nwo=; b=PbGcC81UIqnELOaGaoq5oTb9ucYR3XFbFBAuz7SnVXkVisFMTqMTGEjPFn4TD6CAP0JUV0v9Dpqyvhq4iqfykfJb87uOTy6Tyt6axXq76+ZQUerRGss+tpseBuOh0VFQKUKdnRmc9dYTXbU2HEGrbum5v7iHkyW+8rL3b6YQhN0= Received: from VI1PR08CA0170.eurprd08.prod.outlook.com (2603:10a6:800:d1::24) by AM5PR0801MB1891.eurprd08.prod.outlook.com (2603:10a6:203:4a::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2327.23; Fri, 4 Oct 2019 14:34:54 +0000 Received: from VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::205) by VI1PR08CA0170.outlook.office365.com (2603:10a6:800:d1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.20 via Frontend Transport; Fri, 4 Oct 2019 14:34:54 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; vger.kernel.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;vger.kernel.org; dmarc=none action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT042.mail.protection.outlook.com (10.152.19.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2305.15 via Frontend Transport; Fri, 4 Oct 2019 14:34:53 +0000 Received: ("Tessian outbound 3fba803f6da3:v33"); Fri, 04 Oct 2019 14:34:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0798540fbde5b4ef X-CR-MTA-TID: 64aa7808 Received: from e28735ce9d3a.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.0.55]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 14D801F9-9CE1-413F-9B1E-3C7D8327D8A5.1; Fri, 04 Oct 2019 14:34:42 +0000 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01lp2055.outbound.protection.outlook.com [104.47.0.55]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e28735ce9d3a.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 04 Oct 2019 14:34:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eoh65+Yw/SOSHXFMB0nANtTj7X7phw/0a7R+UGIul1Y3voyG1q1ItIfNhasUQH+Z3tjOAejREGt3HdR6lvvEC5dbDJTyL/SCDfjKXH651XDBfHhykOvPeJf7E4SIlYJdWKqQDS5ZBhhOwTp2g7d8uS3JLpNAZTMOaZfz58KemUkfLs2bCo/ug2NQ6VGHJryRVxrqEp+o/8z1sjzaBzUh/vCjDLQ/pK0KvHfEFhG26b5r8UhWNUgc9ot91D1vsx5UPdIDiSOwtERUI4NAgRAkB3SKbZlRtuabrtjVmCeIo2M40T7rNPdFh4ojIXzgUat36NTv/BsBWJGrt7ED5ss/3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MK4ZcTaWUSRAjX0xe8+6lEgAOWI0bkyan77WyvE7Nwo=; b=huCNw23ZqbBUP1lLa9cpb/ARdt/lRKwtvRXsElOd5cV3ZaIGPojsh6TDG6dyNybFh0ojUiP46EWKG+eDv+8YXmhRRvfUaFvdtJ3/FBntieAFwOqfFtwdytYOBCodrSLaZN8jkPlofvNfZkmS6I2EITkve7GVOgH7kJeYDvJigqdXIw4xNwhWb0dRFiZ22uaedAuJBJiEpOmmznw1NteX6lE1pnDrkBKW8vszVzf/xSH6sFyk3ifZ/PxDtlrq/NsDnkJ6aEZMAfLIHEPCKULOQbpaJpXPGr74KmKtlncMfFwgI+iOGBLInWPCDq1EWwWCYXv0WEbbqePO422kZsOcXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MK4ZcTaWUSRAjX0xe8+6lEgAOWI0bkyan77WyvE7Nwo=; b=PbGcC81UIqnELOaGaoq5oTb9ucYR3XFbFBAuz7SnVXkVisFMTqMTGEjPFn4TD6CAP0JUV0v9Dpqyvhq4iqfykfJb87uOTy6Tyt6axXq76+ZQUerRGss+tpseBuOh0VFQKUKdnRmc9dYTXbU2HEGrbum5v7iHkyW+8rL3b6YQhN0= Received: from VI1PR08MB4078.eurprd08.prod.outlook.com (20.178.127.92) by VI1PR08MB4288.eurprd08.prod.outlook.com (20.179.25.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2305.20; Fri, 4 Oct 2019 14:34:39 +0000 Received: from VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::7d25:d1f2:e3eb:868b]) by VI1PR08MB4078.eurprd08.prod.outlook.com ([fe80::7d25:d1f2:e3eb:868b%6]) with mapi id 15.20.2305.023; Fri, 4 Oct 2019 14:34:39 +0000 From: Mihail Atanassov To: "dri-devel@lists.freedesktop.org" CC: Mihail Atanassov , nd , Maxime Ripard , Maarten Lankhorst , Sean Paul , "james qian wang (Arm Technology China)" , Liviu Dudau , Brian Starkey , David Airlie , Daniel Vetter , Russell King , "linux-kernel@vger.kernel.org" Subject: [PATCH 2/3] drm/komeda: Memory manage struct komeda_drv in probe/remove Thread-Topic: [PATCH 2/3] drm/komeda: Memory manage struct komeda_drv in probe/remove Thread-Index: AQHVesDatT7fIDs+C0WcvAQ2c1lXGQ== Date: Fri, 4 Oct 2019 14:34:39 +0000 Message-ID: <20191004143418.53039-3-mihail.atanassov@arm.com> References: <20191004143418.53039-1-mihail.atanassov@arm.com> In-Reply-To: <20191004143418.53039-1-mihail.atanassov@arm.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [217.140.106.52] x-clientproxiedby: LNXP265CA0001.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::13) To VI1PR08MB4078.eurprd08.prod.outlook.com (2603:10a6:803:e5::28) x-mailer: git-send-email 2.23.0 Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Mihail.Atanassov@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: 4e7ab124-5362-47a5-12c4-08d748d80522 X-MS-Office365-Filtering-HT: Tenant X-MS-TrafficTypeDiagnostic: VI1PR08MB4288:|VI1PR08MB4288:|AM5PR0801MB1891: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:296;OLM:296; x-forefront-prvs: 018093A9B5 X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(396003)(346002)(39860400002)(366004)(376002)(136003)(199004)(189003)(1076003)(66066001)(14454004)(66556008)(102836004)(2906002)(5660300002)(478600001)(36756003)(76176011)(26005)(50226002)(3846002)(2501003)(6116002)(11346002)(66446008)(386003)(186003)(64756008)(6506007)(66476007)(8936002)(66946007)(2616005)(4326008)(256004)(44832011)(81166006)(6512007)(99286004)(486006)(6436002)(5640700003)(8676002)(6486002)(86362001)(25786009)(71190400001)(476003)(6916009)(7736002)(305945005)(71200400001)(446003)(2351001)(54906003)(316002)(52116002)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR08MB4288;H:VI1PR08MB4078.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: b5k7dmFBQ7V2Gg0Eey0+UbOOxONeoXqgpT9bskVPXBKYyGlTf6AOjsutW+4i0dA9AM2RB9vbzcj6Kss4zMaSaqRfhYV+/Pt2Ir+0yfqD2hAv14nTx2Rw0upHV0PMY9AwL6YjzgbjD13F28yiiBJflgIvKdeGhh0YctHag3xnXHWLugYW6MK7ZTx0a+LGD73VUMC9kCbrurz/fAQGZfQXMqpdbAn/H0QZYKFHq3kFCNO5MqCMFkOKXYdqGTkHGwPU19EAVyvg4QM1cIMnBtdnVDlk8gBmHofmTiJ67d88PBjZ2vOcnJwFl8vy5Kkbp04VefXz5Qyzhwirn5B9hSO3L8trJioPffQH8+IY6P8BUdN7bV0IbVNHkDT/QY5avgLWfGOsQhhXf8DiNKi6ABWltURNuFPzqO/AOh9h1D3Eb7g= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4288 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Mihail.Atanassov@arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT042.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(136003)(39860400002)(346002)(376002)(199004)(189003)(8746002)(2351001)(99286004)(76176011)(356004)(336012)(47776003)(86362001)(14454004)(66066001)(3846002)(2616005)(25786009)(4326008)(81156014)(8676002)(81166006)(476003)(126002)(486006)(2501003)(50226002)(8936002)(11346002)(76130400001)(2906002)(26826003)(63350400001)(1076003)(50466002)(6862004)(5660300002)(36756003)(446003)(305945005)(6116002)(478600001)(70206006)(7736002)(386003)(70586007)(36906005)(6506007)(6486002)(26005)(6512007)(5640700003)(54906003)(102836004)(23756003)(316002)(22756006)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1891;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8d42af8c-9711-46bb-beec-08d748d7fcc7 NoDisclaimer: True X-Forefront-PRVS: 018093A9B5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q92jy7t+tv3jq2r7xjXYidlnkPkqjWwvkPuOK3NGt3mQLbe+U5xZZpabpPsDSmKJWz0yFmDPhj8QPSwEMcaPiChr9m2y2mT5Deo1D4PW4xLIY/2CbwKxZ5jSVSkeQ3pXS/AFAlYS27EuN43i2HjZlSXox050c2jaNMnoScO3fgyJqaet7/RbrQvQV9krmkhTbj/D1+6aPJ0MV83V0HBfKoOAPeMd7otTvuNkXUbKnWzTKMdy9Uy42n23+mXr6lDdosbqgVw/m/pfUAZTqE5141qsSFgQz5wwTyNcUetR31Aqhf1+2f+69sSp2s6QgZRRnwHohS4PQEiYwTvV9juB0W0HsTJG8z/TDk7tNwXIH/eEMKnoIrUP/PDnazGpL2a5uWLCaKqWG1WPA3ZP1KxVke896vvGWsLN+2Bf7Q0baGg= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2019 14:34:53.1348 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e7ab124-5362-47a5-12c4-08d748d80522 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1891 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some fields of komeda_drv members will be useful very early in probe code, so make sure an instance is available. Signed-off-by: Mihail Atanassov --- .../gpu/drm/arm/display/komeda/komeda_drv.c | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c b/drivers/gpu/= drm/arm/display/komeda/komeda_drv.c index 660181bdc008..9ed25ffe0e22 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_drv.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_drv.c @@ -32,22 +32,15 @@ static void komeda_unbind(struct device *dev) if (!mdrv) return; =20 - komeda_kms_fini(mdrv->kms); - komeda_dev_fini(mdrv->mdev); - - dev_set_drvdata(dev, NULL); - devm_kfree(dev, mdrv); + komeda_kms_fini(&mdrv->kms); + komeda_dev_fini(&mdrv->mdev); } =20 static int komeda_bind(struct device *dev) { - struct komeda_drv *mdrv; + struct komeda_drv *mdrv =3D dev_get_drvdata(dev); int err; =20 - mdrv =3D devm_kzalloc(dev, sizeof(*mdrv), GFP_KERNEL); - if (!mdrv) - return -ENOMEM; - err =3D komeda_dev_init(&mdrv->mdev, dev); if (err) goto free_mdrv; @@ -56,8 +49,6 @@ static int komeda_bind(struct device *dev) if (err) goto fini_mdev; =20 - dev_set_drvdata(dev, mdrv); - return 0; =20 fini_mdev: @@ -97,10 +88,15 @@ static int komeda_platform_probe(struct platform_device= *pdev) struct device *dev =3D &pdev->dev; struct component_match *match =3D NULL; struct device_node *child; + struct komeda_drv *mdrv; =20 if (!dev->of_node) return -ENODEV; =20 + mdrv =3D devm_kzalloc(dev, sizeof(*mdrv), GFP_KERNEL); + if (!mdrv) + return -ENOMEM; + for_each_available_child_of_node(dev->of_node, child) { if (of_node_cmp(child->name, "pipeline") !=3D 0) continue; @@ -110,12 +106,20 @@ static int komeda_platform_probe(struct platform_devi= ce *pdev) komeda_add_slave(dev, &match, child, KOMEDA_OF_PORT_OUTPUT, 1); } =20 + dev_set_drvdata(dev, mdrv); + return component_master_add_with_match(dev, &komeda_master_ops, match); } =20 static int komeda_platform_remove(struct platform_device *pdev) { - component_master_del(&pdev->dev, &komeda_master_ops); + struct device *dev =3D &pdev->dev; + struct komeda_drv *mdrv =3D dev_get_drvdata(dev); + + component_master_del(dev, &komeda_master_ops); + + dev_set_drvdata(dev, NULL); + devm_kfree(dev, mdrv); return 0; } =20 --=20 2.23.0