From patchwork Tue Sep 2 12:51:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 4825051 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 0B36B9F2ED for ; Tue, 2 Sep 2014 12:54:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2ED4B20170 for ; Tue, 2 Sep 2014 12:54:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 0B9A7201C7 for ; Tue, 2 Sep 2014 12:54:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 581BB6E470; Tue, 2 Sep 2014 05:54:23 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by gabe.freedesktop.org (Postfix) with ESMTP id 60A556E472 for ; Tue, 2 Sep 2014 05:54:22 -0700 (PDT) Received: by mail-vc0-f178.google.com with SMTP id la4so6784280vcb.23 for ; Tue, 02 Sep 2014 05:54:22 -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=Q2+yi7xjyxHxz8DKOxMvdWcOdWv9xJRN9rttyPThI9g=; b=iUrMNcXx3FrYda74psqUtwD0+UWAJxpZggv1ueJ+xdXNW8TgIm1TJq2dZz/UsSGvtT jwDjT5lbuU7fM2AeKUKqZaCqGHC7S76CxNZlbC1c01x0Ta+Uxf8c3jx5o3J1I+4Oe8DW zfNimHeSuikg6dFD9Hf71P5vmJVerLJT6OKNBSeiCGDLHDnEluyqoFE2v9c6W15Rh60B I0PFqt3mUg8meAtr9Qkh2cCE/pwRJs1T6QQZ9mYUz+8V3wzmORX5KBdKnPac47WbZQpE UwVTeGHFv1UiOUB9WVHKFf/zEQgJWvZRZVI2D24dPM6vj2cWQAaMwUpe5F+01twPn7Rl rJfw== X-Gm-Message-State: ALoCoQkUfAVwe4DwYvJ5RP2RrNN5veUDUjZcHY2qCnTrCLPBjTmC2xh/P/m7cfuqZmMKDFv1SPlR X-Received: by 10.52.8.71 with SMTP id p7mr73318vda.77.1409662462014; Tue, 02 Sep 2014 05:54:22 -0700 (PDT) Received: from arch.hh.imgtec.org ([190.2.108.102]) by mx.google.com with ESMTPSA id vm20sm9912017vdb.21.2014.09.02.05.54.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 02 Sep 2014 05:54:21 -0700 (PDT) From: Ezequiel Garcia To: , Dave Airlie Subject: [PATCH/RESEND 5/8] drm/tilcdc: panel: Use devm_kzalloc to simplify the error path Date: Tue, 2 Sep 2014 09:51:19 -0300 Message-Id: <1409662282-7945-6-git-send-email-ezequiel@vanguardiasur.com.ar> X-Mailer: git-send-email 2.0.1 In-Reply-To: <1409662282-7945-1-git-send-email-ezequiel@vanguardiasur.com.ar> References: <1409662282-7945-1-git-send-email-ezequiel@vanguardiasur.com.ar> 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=-5.9 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. Tested-by: Darren Etheridge 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; }