From patchwork Fri Jan 31 10:23:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 3560981 Return-Path: X-Original-To: patchwork-linux-arm@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 D25EC9F3EF for ; Fri, 31 Jan 2014 10:25:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB409201FD for ; Fri, 31 Jan 2014 10:25:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A93F9201D5 for ; Fri, 31 Jan 2014 10:25:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W9BI5-0007GC-5n; Fri, 31 Jan 2014 10:25:41 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W9BI2-0003Vl-EB; Fri, 31 Jan 2014 10:25:38 +0000 Received: from top.free-electrons.com ([176.31.233.9] helo=mail.free-electrons.com) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W9BHz-0003U7-6D for linux-arm-kernel@lists.infradead.org; Fri, 31 Jan 2014 10:25:35 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 92EEAA39; Fri, 31 Jan 2014 11:25:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id 40FA990D; Fri, 31 Jan 2014 11:25:03 +0100 (CET) From: Maxime Ripard To: Mark Brown Subject: [PATCH 2/3] spi: core: Update the devm_spi_register_master documentation Date: Fri, 31 Jan 2014 11:23:11 +0100 Message-Id: <1391163792-21819-3-git-send-email-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1391163792-21819-1-git-send-email-maxime.ripard@free-electrons.com> References: <1391163792-21819-1-git-send-email-maxime.ripard@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140131_052535_330205_5D11F8C6 X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -1.7 (-) Cc: Maxime Ripard , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If the devm_spi_register_master function is used together with the spi_alloc_master as advertised in the documentation, it will either lead to a memory leak if spi_put_master is removed, or we will try to access an already freed memory area during the unregistration function. Advertise that you want to use the devm_spi_alloc_master function in such case. Signed-off-by: Maxime Ripard --- drivers/spi/spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index eb728ec..dc577b7 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1444,7 +1444,7 @@ static void devm_spi_unregister(struct device *dev, void *res) /** * dev_spi_register_master - register managed SPI master controller * @dev: device managing SPI master - * @master: initialized master, originally from spi_alloc_master() + * @master: initialized master, originally from devm_spi_alloc_master() * Context: can sleep * * Register a SPI device as with spi_register_master() which will