From patchwork Tue Jul 3 11:47:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 9787 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id DFB6223E2F for ; Tue, 3 Jul 2012 12:00:14 +0000 (UTC) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by fiordland.canonical.com (Postfix) with ESMTP id ACF0FA183D3 for ; Tue, 3 Jul 2012 12:00:14 +0000 (UTC) Received: by mail-yw0-f50.google.com with SMTP id j63so6253307yhj.37 for ; Tue, 03 Jul 2012 05:00:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=Pa5Xfh956F59+MmQ/9/jsz4bq6UjNzSmvYI8gDIswow=; b=JRo2pyo7YzWhvCDxDD0v+Fn1+ODc7aD7nwbsiGqLkM6BYliz8dvG12brK6wDF4JZu1 MJ6B/FhGV7hbBWPwODRWnRZn2Yf/D80h3zfyBEd5NugIWXie43T+GEaFpVHZGn1aoKlg l7tBg/FoCajsCsV6HwpJHM0LKIqxuiXVewBE0QA4b4C9YiQ9Uayza6gpNtYgFepkD+wx 49E0E/TEfJSNFRvlXxX8sVa4Gpx1sWNvKVY3ewae7mRvhh2/3fmcOifDjlax2bwCSpkw 5dAk5cnT9TWCT2Put3GCOtF+VC18taCF96m+MCooo1g+ozAS9lsmpJZVeM9bkHIU9vw3 pYbg== Received: by 10.42.155.73 with SMTP id t9mr8266605icw.48.1341316814180; Tue, 03 Jul 2012 05:00:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp38784ibb; Tue, 3 Jul 2012 05:00:13 -0700 (PDT) Received: by 10.68.227.163 with SMTP id sb3mr6613333pbc.74.1341316813576; Tue, 03 Jul 2012 05:00:13 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id ms9si23919143pbb.102.2012.07.03.05.00.13 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by pbbrr4 with SMTP id rr4so10881159pbb.37 for ; Tue, 03 Jul 2012 05:00:13 -0700 (PDT) Received: by 10.68.138.169 with SMTP id qr9mr6537175pbb.27.1341316813112; Tue, 03 Jul 2012 05:00:13 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id oo6sm15466531pbc.22.2012.07.03.05.00.10 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 03 Jul 2012 05:00:12 -0700 (PDT) From: Sachin Kamat To: linux-leds@vger.kernel.org Cc: bryan.wu@canonical.com, rpurdie@rpsys.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 1/5] leds: Use devm_kzalloc in leds-max8997.c file Date: Tue, 3 Jul 2012 17:17:50 +0530 Message-Id: <1341316074-14886-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQl0V1grGbfBuHohVC58Z2BMyxqC1K52lIML3Il9P5+AJ4VmTnuhI+sfEqlvxVDXZljvnqZZ devm_kzalloc() makes code cleanup simpler. Signed-off-by: Sachin Kamat --- drivers/leds/leds-max8997.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/leds/leds-max8997.c b/drivers/leds/leds-max8997.c index f4c0e37..d9bcb49 100644 --- a/drivers/leds/leds-max8997.c +++ b/drivers/leds/leds-max8997.c @@ -276,7 +276,7 @@ static int __devinit max8997_led_probe(struct platform_device *pdev) return -ENODEV; } - led = kzalloc(sizeof(*led), GFP_KERNEL); + led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); if (led == NULL) { ret = -ENOMEM; goto err_mem; @@ -315,7 +315,7 @@ static int __devinit max8997_led_probe(struct platform_device *pdev) ret = led_classdev_register(&pdev->dev, &led->cdev); if (ret < 0) - goto err_led; + goto err_mem; ret = device_create_file(led->cdev.dev, &dev_attr_mode); if (ret != 0) { @@ -328,8 +328,6 @@ static int __devinit max8997_led_probe(struct platform_device *pdev) err_file: led_classdev_unregister(&led->cdev); -err_led: - kfree(led); err_mem: return ret; } @@ -340,7 +338,6 @@ static int __devexit max8997_led_remove(struct platform_device *pdev) device_remove_file(led->cdev.dev, &dev_attr_mode); led_classdev_unregister(&led->cdev); - kfree(led); return 0; }