From patchwork Fri Jul 27 07:08:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 10297 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 72DE223E56 for ; Fri, 27 Jul 2012 07:10:02 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 4200AA190E5 for ; Fri, 27 Jul 2012 07:10:02 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so2864191yhp.11 for ; Fri, 27 Jul 2012 00:10:02 -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:in-reply-to:references :x-gm-message-state; bh=+WWY/QghxPL/kKlqEDgIwS9/W5KatjfRwiuqDN49T3o=; b=nZBHu1c7D1f6lATAkwDb/c0r6dEDtP315PqDg8mB5cmiXD7Xu5KmhLZykIOP+3Ll+/ eHUdtU525XJ9fIkQ1Vn/dRmGdOyca1VMYsyPZcLHDK0RBZOAfqK1VwBNgAgbYDMQ2URR ZD7+TDiOeD/WvNXu4J8mUCgd9VP5yj+uYoV5jWG+ulHCEzBI8+2VO5kQrzQndhqnelmX SXdKLjG8EmhIlFBl+/0m3Q+qq74tX+FrNVToLE84srh+N2VJxs6m6I774LNECyA0QyXk wYbJwRBBth413e9hvLnoCfYQ9bvY3Yx6srYk2p6js1Sls/LtGT9sTxmGkUU2M1h8siiF ombA== Received: by 10.50.159.135 with SMTP id xc7mr3718860igb.1.1343373001569; Fri, 27 Jul 2012 00:10:01 -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.43.93.3 with SMTP id bs3csp14916icc; Fri, 27 Jul 2012 00:10:01 -0700 (PDT) Received: by 10.236.75.229 with SMTP id z65mr1427751yhd.7.1343373000788; Fri, 27 Jul 2012 00:10:00 -0700 (PDT) Received: from mail-gg0-f178.google.com (mail-gg0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id g67si1354064yhk.56.2012.07.27.00.10.00 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 00:10:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of sachin.kamat@linaro.org) smtp.mail=sachin.kamat@linaro.org Received: by ggcq6 with SMTP id q6so3306379ggc.37 for ; Fri, 27 Jul 2012 00:10:00 -0700 (PDT) Received: by 10.66.87.70 with SMTP id v6mr3485163paz.14.1343373000157; Fri, 27 Jul 2012 00:10:00 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id qc5sm1355861pbb.6.2012.07.27.00.09.57 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 00:09:59 -0700 (PDT) From: Sachin Kamat To: linux-bluetooth@vger.kernel.org Cc: marcel@holtmann.org, gustavo@padovan.org, johan.hedberg@gmail.com, sachin.kamat@linaro.org, patches@linaro.org Subject: [PATCH 07/11] Bluetooth: Use devm_kzalloc in btsdio.c file Date: Fri, 27 Jul 2012 12:38:37 +0530 Message-Id: <1343372921-18780-8-git-send-email-sachin.kamat@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1343372921-18780-1-git-send-email-sachin.kamat@linaro.org> References: <1343372921-18780-1-git-send-email-sachin.kamat@linaro.org> X-Gm-Message-State: ALoCoQmrea/BJwitqnWLSfH0yEU8e1ynM1ZHJgipqj9USiXOLJ1Ap9Tt7BWzEEmTEWOqzR216vDE devm_kzalloc() eliminates the need to free memory explicitly thereby saving some cleanup code. Signed-off-by: Sachin Kamat --- drivers/bluetooth/btsdio.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/bluetooth/btsdio.c b/drivers/bluetooth/btsdio.c index e10ea03..4a99097 100644 --- a/drivers/bluetooth/btsdio.c +++ b/drivers/bluetooth/btsdio.c @@ -304,7 +304,7 @@ static int btsdio_probe(struct sdio_func *func, tuple = tuple->next; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL); if (!data) return -ENOMEM; @@ -315,10 +315,8 @@ static int btsdio_probe(struct sdio_func *func, skb_queue_head_init(&data->txq); hdev = hci_alloc_dev(); - if (!hdev) { - kfree(data); + if (!hdev) return -ENOMEM; - } hdev->bus = HCI_SDIO; hci_set_drvdata(hdev, data); @@ -340,7 +338,6 @@ static int btsdio_probe(struct sdio_func *func, err = hci_register_dev(hdev); if (err < 0) { hci_free_dev(hdev); - kfree(data); return err; } @@ -366,7 +363,6 @@ static void btsdio_remove(struct sdio_func *func) hci_unregister_dev(hdev); hci_free_dev(hdev); - kfree(data); } static struct sdio_driver btsdio_driver = {