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: 3912501 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4C3A79F1E1 for ; Mon, 31 Mar 2014 03:37:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AE5520384 for ; Mon, 31 Mar 2014 03:37:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A2BEA2037D for ; Mon, 31 Mar 2014 03:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752758AbaCaDhg (ORCPT ); Sun, 30 Mar 2014 23:37:36 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:53989 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752775AbaCaDhf (ORCPT ); Sun, 30 Mar 2014 23:37:35 -0400 Received: by mail-pd0-f175.google.com with SMTP id x10so7391214pdj.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=gg1kMQQ+wWjPj8XBW4LO0EZJUOlLXJKiPFk9u31v1ExUAg2ORbACRyXgSj6KbYDi8i YXrQAUgAJLZlm0R/kcy6/2z+P+GQ1bRjz4W5DcmVsQfE1KCJp30TgklD7W5k/dnxqPQO gh+OVfnweenJ3ntDIqf7JbzVtwfnOdy2gnOiialrEoMuKd6PMOOqK9weP0dzm/+W9vpi M39i7CgKygiJMlR4YWUlffK/MAf977PM9OFvWOzYBeim+UM8QjSH9rIN6Pm2V2KHiVOP 7HOaqVXrzqSE8ScGn5g7vaG1XpbsuZPTp/G1p27d7yJTJ+8Z8YA4PznGKKLIgBNzFm0b PyqA== X-Gm-Message-State: ALoCoQkjcWRbkFvNp4u3x6zqM9AXWr/eYi6lVMeg8JHYrC/yfzJ+YfiK/iTMHtKi6o5WfHALHUak 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@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);