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: 3561031 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 30645C02DC for ; Fri, 31 Jan 2014 10:26:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 36B00201D5 for ; Fri, 31 Jan 2014 10:26:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FB0D200CF for ; Fri, 31 Jan 2014 10:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754135AbaAaKZR (ORCPT ); Fri, 31 Jan 2014 05:25:17 -0500 Received: from top.free-electrons.com ([176.31.233.9]:42877 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754133AbaAaKZP (ORCPT ); Fri, 31 Jan 2014 05:25:15 -0500 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=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Maxime Ripard 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> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.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