From patchwork Mon Feb 12 09:44:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 127961 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3040344ljc; Mon, 12 Feb 2018 01:45:55 -0800 (PST) X-Google-Smtp-Source: AH8x225yffHxlwUsYSVMRL6nYyGUyM1PdWFLHSPepBI3wfVO8GCSK6yes+8p3wtlOqxIOrmkUgvA X-Received: by 10.99.176.69 with SMTP id z5mr8591792pgo.74.1518428754907; Mon, 12 Feb 2018 01:45:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518428754; cv=none; d=google.com; s=arc-20160816; b=OYpfFPAIBv+hWErqbCRvthn9d4WEnqNtEct4JvnywWWRirMFW3KNfA8IGwOjECvYwd b+ixMyAWWR+7DAvPfM2fchPToQE2SpuGq1UOWazoEJCGwnslzm8amAKEk2T+3gPN3HEm 9XWg+vDZOK490baa8pb4Y7jdRzP7+4RME3rSKcP/t5P5Y2Hhv3D5vqf/XKbB2tiOGFCM 2+deVS9MYDoRBePkYRJyCFTjgqxBGrseG9CH1RXmHXLm7CLpz8XtLskdsRbjnVsl/ONq Z3VvswSRVa9oHUMMb1+o0EP6YKOwDy1VQ+lbwHKArsBSGf2+m0SD4q8qBvRuCH5cGcEO OxQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:references:in-reply-to:message-id:date :subject:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=w7ZhQvcyFmJkWvBj5TC1R7Bweusk/oc+8ckwSYR7tDw=; b=FIkhywqzA1Q7Q73LKvB5j3uSdPeK54a9TmVxoJx5YU0nGg4xHq19SCM9W+PJ7lG7ZF dgUVvPBbYR+QY0i9StpQGQzHtyueKFOqv4JQA0T7Svt0G1XW0Q2WEciK8EOUDgtbYLfY 2WHvgAL29SKGiNSyuKHWy/TcZdaGmm6IAoup5eCFk+yyOB3xgBG9gxbh4AjTpPenUmcV 0zXB/7/J09yjxQgqeTKB5lhny9sgkRpMJY22kq6ER9G3Y4dcVznwbjOk5vU2Lklm0RCd /QXFHAGE6b/bVn49B5u6719NI4qYE1gepZPQDTHXFAl8bNxH/x1gzvw7y7wNUzKU5BDz firQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=e+MM9DVM; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id 28si4235960pfl.53.2018.02.12.01.45.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 01:45:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=e+MM9DVM; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D9DE6E142; Mon, 12 Feb 2018 09:45:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fllnx210.ext.ti.com (fllnx210.ext.ti.com [198.47.19.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EF0A6E0FE for ; Mon, 12 Feb 2018 09:45:14 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w1C9jCQv009808; Mon, 12 Feb 2018 03:45:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1518428712; bh=y+0aibwKwH/XgsflE87fLWw+DWaz2Y69oCR70SMeF34=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=e+MM9DVMEiVJJzWYHwzeP+DdVaod6LhN/ph/f/JA50Ihe+wtS+i/No7QV0rUrBWsI TQa1LYSIuBbspASTDtFp3Xg77p9czqcSPSFuxK3I9AeUdPGJbKwnWJpFXamnKKR9vJ kSXvK7neqvutYIQBBp/9SMj5pkO53dAAANGH1Uv4= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9jCAm019281; Mon, 12 Feb 2018 03:45:12 -0600 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 12 Feb 2018 03:45:11 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 12 Feb 2018 03:45:11 -0600 Received: from deskari.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w1C9j0N2003439; Mon, 12 Feb 2018 03:45:10 -0600 From: Tomi Valkeinen To: , Laurent Pinchart , Peter Ujfalusi , Jyri Sarha , Benoit Parrot Subject: [PATCH 05/24] drm/omap: Use devm_kzalloc() to allocate omap_drm_private Date: Mon, 12 Feb 2018 11:44:35 +0200 Message-ID: <1518428694-18018-6-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> References: <1518428694-18018-1-git-send-email-tomi.valkeinen@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomi Valkeinen Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Peter Ujfalusi It makes the cleanup paths a bit cleaner. Signed-off-by: Peter Ujfalusi Signed-off-by: Tomi Valkeinen --- drivers/gpu/drm/omapdrm/omap_drv.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 485684c637ff..3cd9188ab30b 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c @@ -529,19 +529,17 @@ static int pdev_probe(struct platform_device *pdev) return ret; } + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + omap_crtc_pre_init(); ret = omap_connect_dssdevs(); if (ret) goto err_crtc_uninit; - /* Allocate and initialize the driver private structure. */ - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - ret = -ENOMEM; - goto err_disconnect_dssdevs; - } - + /* Initialize the driver private structure. */ priv->dispc_ops = dispc_get_ops(); soc = soc_device_match(omapdrm_soc_devices); @@ -555,7 +553,7 @@ static int pdev_probe(struct platform_device *pdev) ddev = drm_dev_alloc(&omap_drm_driver, &pdev->dev); if (IS_ERR(ddev)) { ret = PTR_ERR(ddev); - goto err_free_priv; + goto err_destroy_wq; } ddev->dev_private = priv; @@ -610,10 +608,8 @@ static int pdev_probe(struct platform_device *pdev) err_free_drm_dev: omap_gem_deinit(ddev); drm_dev_unref(ddev); -err_free_priv: +err_destroy_wq: destroy_workqueue(priv->wq); - kfree(priv); -err_disconnect_dssdevs: omap_disconnect_dssdevs(); err_crtc_uninit: omap_crtc_pre_uninit(); @@ -644,7 +640,6 @@ static int pdev_remove(struct platform_device *pdev) drm_dev_unref(ddev); destroy_workqueue(priv->wq); - kfree(priv); omap_disconnect_dssdevs(); omap_crtc_pre_uninit();