From patchwork Tue Mar 25 04:44:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3885311 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 46692BF540 for ; Tue, 25 Mar 2014 04:44:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6711B2012E for ; Tue, 25 Mar 2014 04:44:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 959672017D for ; Tue, 25 Mar 2014 04:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751753AbaCYEoU (ORCPT ); Tue, 25 Mar 2014 00:44:20 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:41134 "EHLO mail-pd0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbaCYEoT (ORCPT ); Tue, 25 Mar 2014 00:44:19 -0400 Received: by mail-pd0-f174.google.com with SMTP id y13so6274975pdi.33 for ; Mon, 24 Mar 2014 21:44:19 -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=ALs0iokqzhk5TNDjuTJSMGdoJuv1uO1hJrNkZpQJr9o=; b=kd9QsaNO8r2IW/Ti3sme+cxcQxmQ/7ntfWB4roSIhGoWabXrdoDDpAjNcoN6APYTPp DlgbW/pTcDMVcrn8gFAulFfoRD7h1EqsMk1S9gdhoAyFXC9xRWNdJTTd604WTWnrJshG GLgUsPg4E7BzEJis1aoXFHe2UTSKV0CAha3R37YRmbAonpV+tWNLjnMFRvW5XrXUvH9a VgvGCCxaF16O7buraGxbv/D2l0fgLmKyTvfkS7zLLShUeyQ23RBMVcufiyX6nktsBUk9 j6mEApm2F6kEkEot6V645mPzWXW1eLHOuwNPKGVxziidcLLoFq/dNupqoUKY2ePW5pZo 1XwA== X-Gm-Message-State: ALoCoQlbmzyK+HLI+Dqd/HIj/DagTdAn+US1tobMQ2YvdBQT8nauUep/xG79+8pIJoC1R9Iz/31A X-Received: by 10.68.76.68 with SMTP id i4mr76650347pbw.73.1395722659249; Mon, 24 Mar 2014 21:44:19 -0700 (PDT) Received: from [192.168.0.102] (36-239-218-97.dynamic-ip.hinet.net. [36.239.218.97]) by mx.google.com with ESMTPSA id x5sm38812111pbw.26.2014.03.24.21.44.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Mar 2014 21:44:18 -0700 (PDT) Message-ID: <1395722653.16744.1.camel@phoenix> Subject: [PATCH v2] spi: dw: Don't call kfree for memory allocated by devm_kzalloc From: Axel Lin To: Mark Brown Cc: Baruch Siach , Jarkko Nikula , linux-spi@vger.kernel.org Date: Tue, 25 Mar 2014 12:44:13 +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 With devm_kzalloc, the memory is automatically freed when spi_device detach from the bus. Fixes: commit 43f627ac9de42 (spi: dw: fix memory leak on error path) Signed-off-by: Axel Lin Acked-by: Baruch Siach --- v2: Correct Fixes tag and also add Baruch's Ack. drivers/spi/spi-dw.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c index 8b7e4a3..712ac562 100644 --- a/drivers/spi/spi-dw.c +++ b/drivers/spi/spi-dw.c @@ -664,12 +664,6 @@ static int dw_spi_setup(struct spi_device *spi) return 0; } -static void dw_spi_cleanup(struct spi_device *spi) -{ - struct chip_data *chip = spi_get_ctldata(spi); - kfree(chip); -} - static int init_queue(struct dw_spi *dws) { INIT_LIST_HEAD(&dws->queue); @@ -799,7 +793,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws) master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16); master->bus_num = dws->bus_num; master->num_chipselect = dws->num_cs; - master->cleanup = dw_spi_cleanup; master->setup = dw_spi_setup; master->transfer = dw_spi_transfer; master->max_speed_hz = dws->max_freq;