From patchwork Mon Mar 31 03:37:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3912491 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 93B67BF540 for ; Mon, 31 Mar 2014 03:37:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A34F820380 for ; Mon, 31 Mar 2014 03:37:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C071B2037B for ; Mon, 31 Mar 2014 03:37:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752780AbaCaDhg (ORCPT ); Sun, 30 Mar 2014 23:37:36 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:54871 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752758AbaCaDhf (ORCPT ); Sun, 30 Mar 2014 23:37:35 -0400 Received: by mail-pb0-f47.google.com with SMTP id up15so7591739pbc.20 for ; Sun, 30 Mar 2014 20:37:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:content-type :mime-version:content-transfer-encoding; bh=o3BJiG+9Jj9ML35UfLSYSua0YMhwOs9gVJcU9+s2ci8=; b=m01GlU3IQUkUSkyFJH/UCf8vUzmS88lLXXn5X62kDInDSXBrCfXYjU2ncaVgSTt7zg UtgiYFhirpp0WdR6PUZDbshIYNCOFZdtwfxPlPdVk5cpFQ+zUUolZHZwoia0l/BWz6lO n7OUmwZdStPn9hJOzn+naDKhuJ8Q1u7l5/cS6R4roUGAb9P7zjHiPtsLEasbckMTjP2M tQ2wHXkse8mP59++Mh6AVTI4fRy9KtrDNNBDXo3VHGqkCYQjOShT/geIqJXZeVqmm0QY 3GS3GWvje5o9HXoYJCI2GxccwOmI1zFA+D6X3NoRLRp1GBXRRV2bVKmliGAkA6hsHtbL 7iyg== X-Gm-Message-State: ALoCoQlaMfFeSOR8bqoXZJY7uaIIfJ5f7wjJaEVbuU1ohKDTqBLfQTgdSrKb6pUocP+JFIt/WACX X-Received: by 10.66.142.233 with SMTP id rz9mr22539299pab.71.1396237055173; Sun, 30 Mar 2014 20:37:35 -0700 (PDT) Received: from [192.168.1.102] (111-240-57-18.dynamic.hinet.net. [111.240.57.18]) by mx.google.com with ESMTPSA id q7sm40218602pbc.20.2014.03.30.20.37.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 30 Mar 2014 20:37:33 -0700 (PDT) Message-ID: <1396237049.12196.1.camel@phoenix> Subject: [PATCH] spi: s3c24xx: Convert to use devm_kzalloc From: Axel Lin To: Mark Brown Cc: Ben Dooks , Kukjin Kim , linux-samsung-soc@vger.kernel.org, linux-spi@vger.kernel.org Date: Mon, 31 Mar 2014 11:37:29 +0800 X-Mailer: Evolution 3.8.4-0ubuntu1 Mime-Version: 1.0 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Simplify the cleanup code. Signed-off-by: Axel Lin Reviewed-by: Jingoo Han Acked-by: Ben Dooks --- drivers/spi/spi-s3c24xx.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index bed2338..6db14e5 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi) /* allocate settings on the first call */ if (!cs) { - cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL); + cs = devm_kzalloc(&spi->dev, + sizeof(struct s3c24xx_spi_devstate), + GFP_KERNEL); if (!cs) { dev_err(&spi->dev, "no memory for controller state\n"); return -ENOMEM; @@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi) return 0; } -static void s3c24xx_spi_cleanup(struct spi_device *spi) -{ - kfree(spi->controller_state); -} - static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) { return hw->tx ? hw->tx[count] : 0; @@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; hw->master->setup = s3c24xx_spi_setup; - hw->master->cleanup = s3c24xx_spi_cleanup; dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);