From patchwork Fri Jul 27 07:08:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sachin Kamat X-Patchwork-Id: 10300 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 28BA723E56 for ; Fri, 27 Jul 2012 07:10:11 +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 ED797A190C3 for ; Fri, 27 Jul 2012 07:10:10 +0000 (UTC) Received: by mail-yw0-f52.google.com with SMTP id p61so2864191yhp.11 for ; Fri, 27 Jul 2012 00:10:10 -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=hBW89FSjdzb84Hp4/mfHx8XV/U+UvsNSaJPESvvnsF0=; b=B5Cf/Dt8RlVKASNq9oPSZuUz6ipKvDFYFsnOzFIb5Q/pWV6gAaSsJr/6cOZJa7GFmB fLdoFzC91sN92xfOfr+LM7JGvnJsNNtxhx35Jj+S8Y0n7riVsGUrRi5TTctgXnD7x5xE ywxzLX2EjBf5zHgk6kibaRJPCZ7+OFWOHFt9wWOvehB4MzP27JsJXjhoLtAJ6dyxeEfr +NVAdeU5+3taIFS9vQCLLswb4mUBZDSUe+bDlP0OVTDpw1wmS7f/RNsM+OhDZw0uikm4 9uEmicgsn6PIBbTY/S3qGvcom9rB/dZF9Z5PiqDkq0eXsd2Z1x7PP+k7xugdgKhpj49z yhfQ== Received: by 10.50.220.136 with SMTP id pw8mr1075356igc.1.1343373010603; Fri, 27 Jul 2012 00:10:10 -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 bs3csp14925icc; Fri, 27 Jul 2012 00:10:10 -0700 (PDT) Received: by 10.236.165.102 with SMTP id d66mr1310839yhl.54.1343373010094; Fri, 27 Jul 2012 00:10:10 -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.09 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 00:10:10 -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 mail-gg0-f178.google.com with SMTP id q6so3306379ggc.37 for ; Fri, 27 Jul 2012 00:10:09 -0700 (PDT) Received: by 10.66.83.6 with SMTP id m6mr3420592pay.29.1343373009647; Fri, 27 Jul 2012 00:10:09 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id qc5sm1355861pbb.6.2012.07.27.00.10.06 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 27 Jul 2012 00:10:09 -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 10/11] Bluetooth: Use devm_kzalloc in btwilink.c file Date: Fri, 27 Jul 2012 12:38:40 +0530 Message-Id: <1343372921-18780-11-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: ALoCoQnWf9ssEvmSO54HdXqFErs05dxx6IUTD8XnCWKpJoNxgBLeN7pwTlXEV8EEIa3BBFBoZgwK devm_kzalloc() eliminates the need to free memory explicitly thereby saving some cleanup code. Signed-off-by: Sachin Kamat --- drivers/bluetooth/btwilink.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/bluetooth/btwilink.c b/drivers/bluetooth/btwilink.c index 8869469..4ad7b35 100644 --- a/drivers/bluetooth/btwilink.c +++ b/drivers/bluetooth/btwilink.c @@ -297,16 +297,14 @@ static int bt_ti_probe(struct platform_device *pdev) struct hci_dev *hdev; int err; - hst = kzalloc(sizeof(struct ti_st), GFP_KERNEL); + hst = devm_kzalloc(&pdev->dev, sizeof(struct ti_st), GFP_KERNEL); if (!hst) return -ENOMEM; /* Expose "hciX" device to user space */ hdev = hci_alloc_dev(); - if (!hdev) { - kfree(hst); + if (!hdev) return -ENOMEM; - } BT_DBG("hdev %p", hdev); @@ -321,7 +319,6 @@ static int bt_ti_probe(struct platform_device *pdev) err = hci_register_dev(hdev); if (err < 0) { BT_ERR("Can't register HCI device error %d", err); - kfree(hst); hci_free_dev(hdev); return err; } @@ -347,7 +344,6 @@ static int bt_ti_remove(struct platform_device *pdev) hci_unregister_dev(hdev); hci_free_dev(hdev); - kfree(hst); dev_set_drvdata(&pdev->dev, NULL); return 0;