From patchwork Fri Jul 13 09:06:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 9978 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 E1F3224027 for ; Fri, 13 Jul 2012 09:06:48 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 961FEA18208 for ; Fri, 13 Jul 2012 09:06:48 +0000 (UTC) Received: by yenq6 with SMTP id q6so3618499yen.11 for ; Fri, 13 Jul 2012 02:06:48 -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=axwfHp0zpdRE/+ayURX15MrSpirxsPDFCdYoDVQS/FY=; b=lxBlT0CVunlIzQF3bke7E2ZE4UfXSX5qZjtI7Bvor5WQG0aLES8zkp3UtRQ0DPH3O0 1xNEBzDO84WxM8zScdlc0jlBmvXKzOELI2qoRAha15OYCkze9vRUQAr0E+UyH+mvby9T T/7p3CGacnGGkmiHMzZgXuRhH8HDx/5MEE8iTkVn3/av4CSe9rX67zTXamlobE62/j6a cSw2os1g9hMmLT/N48HUuApx3GnnWS0yNcnyfizRFmrrRXdVNO29nX1FWvCJhmA49iCm Zy0cTqu3LSywMMmq+jYnxvtqLEfiLazKLY3uKhl769nQYQ6exFL0V6L20PFU0jLE7W4x DCCw== Received: by 10.50.40.193 with SMTP id z1mr283469igk.0.1342170407910; Fri, 13 Jul 2012 02:06:47 -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.241.2 with SMTP id lc2csp13108ibb; Fri, 13 Jul 2012 02:06:47 -0700 (PDT) Received: by 10.68.231.39 with SMTP id td7mr2483281pbc.3.1342170406794; Fri, 13 Jul 2012 02:06:46 -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 kc9si13534362pbc.295.2012.07.13.02.06.46 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jul 2012 02:06:46 -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 rr4so6261563pbb.37 for ; Fri, 13 Jul 2012 02:06:46 -0700 (PDT) Received: by 10.68.212.138 with SMTP id nk10mr1772317pbc.93.1342170406440; Fri, 13 Jul 2012 02:06:46 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id rs4sm5653237pbc.0.2012.07.13.02.06.43 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 13 Jul 2012 02:06:45 -0700 (PDT) From: Sachin Kamat To: lm-sensors@lm-sensors.org Cc: khali@linux-fr.org, linux@roeck-us.net, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH] hwmon: s3c-hwmon: Use devm_kzalloc instead of kzalloc Date: Fri, 13 Jul 2012 14:36:28 +0530 Message-Id: <1342170388-5682-1-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkBITFCEecGrzBxFiG4rK/AlNUH6tT+wjrMz+qZcPho0SRtEf53DH0zKWQleqRqwQQemCJl This makes the code simpler as explicit freeing is not needed. Signed-off-by: Sachin Kamat --- drivers/hwmon/s3c-hwmon.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c index f6c26d1..b7975f8 100644 --- a/drivers/hwmon/s3c-hwmon.c +++ b/drivers/hwmon/s3c-hwmon.c @@ -288,7 +288,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) return -EINVAL; } - hwmon = kzalloc(sizeof(struct s3c_hwmon), GFP_KERNEL); + hwmon = devm_kzalloc(&dev->dev, sizeof(struct s3c_hwmon), GFP_KERNEL); if (hwmon == NULL) { dev_err(&dev->dev, "no memory\n"); return -ENOMEM; @@ -303,8 +303,7 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) hwmon->client = s3c_adc_register(dev, NULL, NULL, 0); if (IS_ERR(hwmon->client)) { dev_err(&dev->dev, "cannot register adc\n"); - ret = PTR_ERR(hwmon->client); - goto err_mem; + return PTR_ERR(hwmon->client); } /* add attributes for our adc devices. */ @@ -363,8 +362,6 @@ static int __devinit s3c_hwmon_probe(struct platform_device *dev) err_registered: s3c_adc_release(hwmon->client); - err_mem: - kfree(hwmon); return ret; }