From patchwork Tue Mar 25 01:25:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 3885031 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 831CDBF540 for ; Tue, 25 Mar 2014 01:25:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA0792026C for ; Tue, 25 Mar 2014 01:25:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2A052022F for ; Tue, 25 Mar 2014 01:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751158AbaCYBZn (ORCPT ); Mon, 24 Mar 2014 21:25:43 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:40840 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751211AbaCYBZ3 (ORCPT ); Mon, 24 Mar 2014 21:25:29 -0400 Received: by mail-pd0-f176.google.com with SMTP id r10so6058986pdi.21 for ; Mon, 24 Mar 2014 18:25:28 -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=Z73xjRQtsBVI72PKrnYbuEIBoe5G6AzA6Sm3tNfRYx4=; b=RA2hk9zymwgNQLEdNn6g6/W1P9bGeOE7laFhKs0W0f/hZaFhoaBMzOBkn+sU3lwO0r TsvYztNt8eb9953Wb8HPPLG1YGbTpwL3hUcIv48tF8SkrMmNg4tTeYXICNIB8JWvXpAl f2z4WNMofdmZYTwo/2hJybVRD9ydXuop1Y4OxtyWhDJGn7CYl4pLxPsTbuX0ZDntcVCD MzaAowi2PV+fGuXuODn80KFHQFtBsFrI4ugw2VUMrWfHRfFylg03xqWUEG1LbIe8LwVH CkfJtToAOZ3ZEkfOoFk8l2YJ2he+fBJZ78MIOcuy1CjFgD2kYr+zAad5PNZAvdE0iv7R 1VnA== X-Gm-Message-State: ALoCoQmG3X/0LMFugaXVcuKV2Qnaip2FXJkXgLELLjIEiSYpzwULXp3edPttYQrE29T5WpbpFOdF X-Received: by 10.68.13.42 with SMTP id e10mr75235751pbc.118.1395710728643; Mon, 24 Mar 2014 18:25:28 -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 db3sm37174038pbb.10.2014.03.24.18.25.26 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 24 Mar 2014 18:25:28 -0700 (PDT) Message-ID: <1395710723.29281.3.camel@phoenix> Subject: [PATCH] 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 09:25:23 +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 04f421e7b0b1 (spi: dw: use managed resources) Signed-off-by: Axel Lin Acked-by: Baruch Siach --- 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;