From patchwork Thu May 7 07:13:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 6354271 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4C20EBEEE1 for ; Thu, 7 May 2015 07:09:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F469203AC for ; Thu, 7 May 2015 07:09:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 86E52202F2 for ; Thu, 7 May 2015 07:09:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751837AbbEGHJe (ORCPT ); Thu, 7 May 2015 03:09:34 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35184 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbbEGHJd (ORCPT ); Thu, 7 May 2015 03:09:33 -0400 Received: by pdbqd1 with SMTP id qd1so33263565pdb.2 for ; Thu, 07 May 2015 00:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=inukjO/qxX3JJDjVYr1lA03mSxht1P+XOgA+xNffcSM=; b=vfOOHPdBBijn5yPUhzvEHcvDQ932Hl1GmyfR8AFgEqY0crrnSMJQ+Wmij7eR87FhwW BT6roaRYmJocSL7OG6rffrISf7iYHM0dGlirbcypeYAGgHez7sw1tM3KRAsva3fJdOgO OKnaigN72iXp9Xqrnxj6ne7Fc0OxnK4fq21edhb4JEeluhBzsJ4aHOODEKwqcPSc8PwQ Es86vl43lPLz3OCJdWBN9G9dKmoULvVPwUkiovs7wed/1zGHuGE9utQTZZ9D+LMV/SO1 fORogqIC7FjdZodXtdjdvD450g28F7e0eMb5YseyttfYvyZB7fTAkdPHC5JxfPJNUvu+ v/BA== X-Received: by 10.66.120.69 with SMTP id la5mr4594318pab.66.1430982573045; Thu, 07 May 2015 00:09:33 -0700 (PDT) Received: from ip-172-31-29-47.ap-northeast-1.compute.internal (ec2-54-65-106-64.ap-northeast-1.compute.amazonaws.com. [54.65.106.64]) by mx.google.com with ESMTPSA id v7sm1078677pde.81.2015.05.07.00.09.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 May 2015 00:09:32 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, workgroup.linux@csr.com, Qipan Li , Barry Song Subject: [PATCH 1/2] spi: sirf: replace kmalloc by devm_kzalloc Date: Thu, 7 May 2015 07:13:10 +0000 Message-Id: <1430982791-8681-1-git-send-email-21cnbao@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Qipan Li Signed-off-by: Qipan Li Signed-off-by: Barry Song --- drivers/spi/spi-sirf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-sirf.c b/drivers/spi/spi-sirf.c index a69ccb7..ae4bd11 100644 --- a/drivers/spi/spi-sirf.c +++ b/drivers/spi/spi-sirf.c @@ -758,7 +758,7 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) /* We are not using dummy delay between command and data */ writel(0, sspi->base + SIRFSOC_SPI_DUMMY_DELAY_CTL); - sspi->dummypage = kmalloc(2 * PAGE_SIZE, GFP_KERNEL); + sspi->dummypage = devm_kzalloc(&pdev->dev, 2 * PAGE_SIZE, GFP_KERNEL); if (!sspi->dummypage) { ret = -ENOMEM; goto free_clk; @@ -766,12 +766,10 @@ static int spi_sirfsoc_probe(struct platform_device *pdev) ret = spi_bitbang_start(&sspi->bitbang); if (ret) - goto free_dummypage; + goto free_clk; dev_info(&pdev->dev, "registerred, bus number = %d\n", master->bus_num); return 0; -free_dummypage: - kfree(sspi->dummypage); free_clk: clk_disable_unprepare(sspi->clk); clk_put(sspi->clk); @@ -794,7 +792,6 @@ static int spi_sirfsoc_remove(struct platform_device *pdev) sspi = spi_master_get_devdata(master); spi_bitbang_stop(&sspi->bitbang); - kfree(sspi->dummypage); clk_disable_unprepare(sspi->clk); clk_put(sspi->clk); dma_release_channel(sspi->rx_chan);