From patchwork Fri Jul 11 14:18:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4535441 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8ACF99F3E3 for ; Fri, 11 Jul 2014 15:35:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9ED3220274 for ; Fri, 11 Jul 2014 15:35:55 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id ACD5020266 for ; Fri, 11 Jul 2014 15:35:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 09F0B6E28A; Fri, 11 Jul 2014 08:35:54 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yh0-f47.google.com (mail-yh0-f47.google.com [209.85.213.47]) by gabe.freedesktop.org (Postfix) with ESMTP id 8474E6E844 for ; Fri, 11 Jul 2014 07:23:27 -0700 (PDT) Received: by mail-yh0-f47.google.com with SMTP id v1so429935yhn.6 for ; Fri, 11 Jul 2014 07:23:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7KFp1WxQ0DN+PgaIHOzK+FKUs885LaWTo/MafDk8XBU=; b=hTvL/ajD2qE0dIcGGjEBWHtC7CvSg8J3U0XYZWLTF42cyCfloBdZqawc0/oOQYnbv7 hQsb8LXLm1RXQXQ2bTrfNcvhgqVnE7y1nqDTTj27tfms9v+ziWaTHp5lVIXRPKqlUarp /2PIHY47nPii4A3O89jBe5I2qxbu9ubaNGkzelMcGUwJuKbSYvmJLv/n3yjBXKjzIfQK IIZ7muA0WKJNy5+/aF/37DdYvpzqOipsSco9rC+0jlvsZlLR+0h+EUCQOaH7/x/guRHk rzwSdHn6SYebHbEnrmsgEUZs7QH15baDsNh1Nxdkk6ZE6nGb3P45KgdDeXbzbbUFg3ut VRuA== X-Gm-Message-State: ALoCoQlcF/NkiotseeSOTvsss3RbQ72t0ukHNzHGvSzOdER26U4YaMmaMNd0kT7QTDIEqhHpVsoy X-Received: by 10.236.41.234 with SMTP id h70mr82599159yhb.61.1405088607090; Fri, 11 Jul 2014 07:23:27 -0700 (PDT) Received: from localhost.localdomain ([190.2.108.113]) by mx.google.com with ESMTPSA id f63sm5309293yhf.1.2014.07.11.07.23.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Jul 2014 07:23:26 -0700 (PDT) From: Ezequiel Garcia To: , , Dave Airlie Subject: [PATCH 5/8] drm/tilcdc: panel: Use devm_kzalloc to simplify the error path Date: Fri, 11 Jul 2014 11:18:51 -0300 Message-Id: <1405088334-11215-6-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1405088334-11215-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1405088334-11215-1-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailman-Approved-At: Fri, 11 Jul 2014 08:35:47 -0700 Cc: daniel.vetter@ffwll.ch, Russell King , Ezequiel Garcia X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using the managed variant to allocate the resource makes the code simpler and less error-prone. Signed-off-by: Ezequiel Garcia --- drivers/gpu/drm/tilcdc/tilcdc_panel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_panel.c b/drivers/gpu/drm/tilcdc/tilcdc_panel.c index 4b36e68..c716c12 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_panel.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_panel.c @@ -354,7 +354,7 @@ static int panel_probe(struct platform_device *pdev) return -ENXIO; } - panel_mod = kzalloc(sizeof(*panel_mod), GFP_KERNEL); + panel_mod = devm_kzalloc(&pdev->dev, sizeof(*panel_mod), GFP_KERNEL); if (!panel_mod) return -ENOMEM; @@ -391,7 +391,6 @@ fail_timings: display_timings_release(panel_mod->timings); fail_free: - kfree(panel_mod); tilcdc_module_cleanup(mod); return ret; } @@ -405,7 +404,6 @@ static int panel_remove(struct platform_device *pdev) tilcdc_module_cleanup(mod); kfree(panel_mod->info); - kfree(panel_mod); return 0; }