From patchwork Thu Sep 12 05:54:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2876121 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BE991BF43F for ; Thu, 12 Sep 2013 05:55:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9DBD02022D for ; Thu, 12 Sep 2013 05:55:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D90212010C for ; Thu, 12 Sep 2013 05:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753327Ab3ILFyo (ORCPT ); Thu, 12 Sep 2013 01:54:44 -0400 Received: from mail-ea0-f176.google.com ([209.85.215.176]:49583 "EHLO mail-ea0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754748Ab3ILFyj (ORCPT ); Thu, 12 Sep 2013 01:54:39 -0400 Received: by mail-ea0-f176.google.com with SMTP id q16so4999658ead.7 for ; Wed, 11 Sep 2013 22:54:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:in-reply-to:references:content-type; bh=PxkyqaIg6zrwBBLO8gQpF4DB2PIBLlz3zmIYHfWQkLE=; b=k4KOIwT6Xn5vEwCeOTzA2sUuk4YgWkyNMbdZ6lvEqLzUa+8lJAJJnXeVMhvc7PO47O 7KTWIf3bGUtHeXLy+XTGCuqtEG5qnJcSCkG4GS0iK4/9+Qwq/zX7/FLY8i1K1O91d00T TeuwZPJITLLHb8rRX9ZCB/Oo7CE61HqOznkQrbn509Pon/7SMpN/ZaM3eRGf+SXSZisR Rdm8WA/+E+DNKDbm0qdvoaTNvCSlhRWK/v94kTAqlTpvtU0zn3YShJM/kvy4l3J2ObTz ZGvvkg6EhZv2+DP9gk9K4MpefWv+6LBVhy8jbrC43vlWasUbbPx6hKgyzJgMs46j6gGl 8a0w== X-Gm-Message-State: ALoCoQnbMzH05vNRf++zz4s3kO14VEbhQL4mhd3R1mPW9WRoAtyIYlteHyvfbeicD5Pw3ebtnMjE X-Received: by 10.14.37.4 with SMTP id x4mr8409379eea.16.1378965278641; Wed, 11 Sep 2013 22:54:38 -0700 (PDT) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id n48sm2650586eeg.17.1969.12.31.16.00.00 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 11 Sep 2013 22:54:37 -0700 (PDT) From: Michal Simek To: linux-kernel@vger.kernel.org, monstr@monstr.eu Cc: Jean-Christophe Plagniol-Villard , Tomi Valkeinen , linux-fbdev@vger.kernel.org Subject: [PATCH 2/3] video: xilinxfb: Use devm_kzalloc instead of kzalloc Date: Thu, 12 Sep 2013 07:54:33 +0200 Message-Id: X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> References: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> In-Reply-To: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> References: <7016a90750626ba866dddc6f85cfdd71943f6891.1378965270.git.michal.simek@xilinx.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00, MIME_HEADER_CTYPE_ONLY, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, T_TVD_MIME_NO_HEADERS, 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 Simplify driver probe and release function. Signed-off-by: Michal Simek Reviewed-by: Jingoo Han --- drivers/video/xilinxfb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 1.8.2.3 diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 123cd70..fd9c430 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -368,7 +368,6 @@ err_fbmem: devm_iounmap(dev, drvdata->regs); err_region: - kfree(drvdata); dev_set_drvdata(dev, NULL); return rc; @@ -403,7 +402,6 @@ static int xilinxfb_release(struct device *dev) dcr_unmap(drvdata->dcr_host, drvdata->dcr_len); #endif - kfree(drvdata); dev_set_drvdata(dev, NULL); return 0; @@ -425,7 +423,7 @@ static int xilinxfb_of_probe(struct platform_device *pdev) pdata = xilinx_fb_default_pdata; /* Allocate the driver data region */ - drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); + drvdata = devm_kzalloc(&pdev->dev, sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { dev_err(&pdev->dev, "Couldn't allocate device private record\n"); return -ENOMEM; @@ -453,7 +451,6 @@ static int xilinxfb_of_probe(struct platform_device *pdev) drvdata->dcr_host = dcr_map(op->dev.of_node, start, drvdata->dcr_len); if (!DCR_MAP_OK(drvdata->dcr_host)) { dev_err(&op->dev, "invalid DCR address\n"); - kfree(drvdata); return -ENODEV; } }