From patchwork Sun Jan 6 04:53:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Devendra Naga X-Patchwork-Id: 1937061 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 702CFDF2A2 for ; Sun, 6 Jan 2013 04:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755568Ab3AFExk (ORCPT ); Sat, 5 Jan 2013 23:53:40 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:47438 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755310Ab3AFExk (ORCPT ); Sat, 5 Jan 2013 23:53:40 -0500 Received: by mail-pa0-f54.google.com with SMTP id bi5so10127280pad.41 for ; Sat, 05 Jan 2013 20:53:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=jqGmkVT+rcps98s2Vp5LDhWxkj3//oB0cRpJ2sCJkfI=; b=rdVaQijp7H2tJSMESVrGw173PXFTNu9jUXU/aPZsStOS5JHgvZYBwThPY4nJo/icDd MCLDLLfh4K9JyyRaJG+jzhnFm0R9RidstlEG8Cp3yhqWn0SO+ufmZbTX5TJ13j3/qdiv RCymukmuY8V0/+NOjl3qm7qGr7a7V8B1kY++lNLujP1QYps+uUE9YVbI9PGQ/Fxv03lM wSO2PIQWKNxfI3NPJUJhbgv3mSkG8aKyToP/O+jj/rniXqD0g+qbin7wphySdHtQrREs Dw59L1pSNrxF9vygTTlOqOnk697olvcqah8Azw5tUyqlJn/als95/PI/SSPMi4vCQ9wv 7PBA== X-Received: by 10.68.251.233 with SMTP id zn9mr402092pbc.7.1357448019490; Sat, 05 Jan 2013 20:53:39 -0800 (PST) Received: from localhost.localdomain ([122.172.33.14]) by mx.google.com with ESMTPS id gv9sm35174367pbc.21.2013.01.05.20.53.35 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 Jan 2013 20:53:38 -0800 (PST) From: Devendra Naga To: Anton Vorontsov , David Woodhouse , linux-pm@vger.kernel.org Cc: Devendra Naga Subject: [PATCH] power: max17040: use devm_kzalloc Date: Sat, 5 Jan 2013 23:53:25 -0500 Message-Id: <1357448005-20896-1-git-send-email-devendra.aaru@gmail.com> X-Mailer: git-send-email 1.7.10.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org use devm_kzalloc and no need of error path and unload frees Signed-off-by: Devendra Naga --- drivers/power/max17040_battery.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index 22cfe9c..74a0bd9 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c @@ -207,7 +207,7 @@ static int max17040_probe(struct i2c_client *client, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) return -EIO; - chip = kzalloc(sizeof(*chip), GFP_KERNEL); + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); if (!chip) return -ENOMEM; @@ -225,7 +225,6 @@ static int max17040_probe(struct i2c_client *client, ret = power_supply_register(&client->dev, &chip->battery); if (ret) { dev_err(&client->dev, "failed: power supply register\n"); - kfree(chip); return ret; } @@ -244,7 +243,6 @@ static int max17040_remove(struct i2c_client *client) power_supply_unregister(&chip->battery); cancel_delayed_work(&chip->work); - kfree(chip); return 0; }