Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9047278pxu; Mon, 28 Dec 2020 05:21:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwLv6am6QSOM5upeFY1MYETHt0Z33SPJHaz/zMZpJpK530JA0enc1nlLJ0gfTi3N49HPfLh X-Received: by 2002:a17:906:8587:: with SMTP id v7mr40599857ejx.381.1609161668142; Mon, 28 Dec 2020 05:21:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161668; cv=none; d=google.com; s=arc-20160816; b=e8dS0A4XYW/m1+mW7SE/X2NdK+UeGZhamab5xNJ+8XiPXMTxPPHrtVRasvZkK69yMd /O9G1s5kvoZMJx7dILoH5EROLFx0rrhJy9+6lVTgRrZKvb+Lxuz64rEHkV5YRE8v1JX5 LXTV3X6wrxOpUvaVfHrayJXRy9Y/nTYG3oSxPxIUb8I9iBL7V46cSSOlezj8aaMgZjKz RGMfQm6R98XsATr1Ioh5fJ/An383w8dChkSR00sSNS80vCvM8Hhx9BFl7RbESTRNy7+8 ZQitIl+ubbfiVPbXMDFkdykl89xgC+oMahPgOZeFpEPh2Zn6G6RrW30nPqyKslPhrriU +TLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uoOhbXP1vFN8mZDi7nq0gRu5c8X9x8aochBvmAPMIcY=; b=WHLtUCujM0+btLTh2uwl9vMDM04QarBktOwvghGukTdWADWhkRpgHDkpyDBbL99FNk aXh/rd2cduxbUZbOFiPF/pSloDtLuHbuNuffSUXyNf1wMvAjf5uDeCu+LGqTYeaK9ULb YfqCa/G61Yygy84NJNaj86RlN+iWCKkmmcoOvRYU1khRSr3rQNFYUISSQcrIigYexr62 3XuS7twCTCLBXbhnxc/OmqBkT18clOsoSBYV6edUpBN/UHgnWRcNGmTNZwC0UwUG0t57 62pc41gf9oP5zF11ngYxZ20GuJncwD54M0JKFEYJ7kIEEF4oIk6vFjLFmQGwmIDtcVeh Up4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LIrqxJip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq10si19380409edb.140.2020.12.28.05.20.45; Mon, 28 Dec 2020 05:21:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LIrqxJip; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387506AbgL1NSc (ORCPT + 99 others); Mon, 28 Dec 2020 08:18:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:47074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387517AbgL1NSa (ORCPT ); Mon, 28 Dec 2020 08:18:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 32662208BA; Mon, 28 Dec 2020 13:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161469; bh=HKVBM16avOEKdjz+NaHmxjroT+xlNi3GmgGkoe+Jq/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LIrqxJipnRbvU5u0CnuIJS2V+Dj96XnZA/jIP/K5vCp18mTZHnlOvwvss1foCFcIY uxMKqMNbV7JCTIp1q3xY2NKsFynRwimdDskrMsSwZowb6udo4brVYao0la7fhCEHZV 0mBlU8vKseWjW5Bgm1Nn/Flv7SQnNGapu8qIdF2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Bert Vermeulen , Mark Brown Subject: [PATCH 4.14 223/242] spi: rb4xx: Dont leak SPI master in probe error path Date: Mon, 28 Dec 2020 13:50:28 +0100 Message-Id: <20201228124915.647530034@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner commit a4729c3506c3eb1a6ca5c0289f4e7cafa4115065 upstream. If the calls to devm_clk_get(), devm_spi_register_master() or clk_prepare_enable() fail on probe of the Mikrotik RB4xx SPI driver, the spi_master struct is erroneously not freed. Fix by switching over to the new devm_spi_alloc_master() helper. Fixes: 05aec357871f ("spi: Add SPI driver for Mikrotik RB4xx series boards") Signed-off-by: Lukas Wunner Cc: # v4.2+: 5e844cc37a5c: spi: Introduce device-managed SPI controller allocation Cc: # v4.2+ Cc: Bert Vermeulen Link: https://lore.kernel.org/r/369bf26d71927f60943b1d9d8f51810f00b0237d.1607286887.git.lukas@wunner.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-rb4xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-rb4xx.c +++ b/drivers/spi/spi-rb4xx.c @@ -148,7 +148,7 @@ static int rb4xx_spi_probe(struct platfo if (IS_ERR(spi_base)) return PTR_ERR(spi_base); - master = spi_alloc_master(&pdev->dev, sizeof(*rbspi)); + master = devm_spi_alloc_master(&pdev->dev, sizeof(*rbspi)); if (!master) return -ENOMEM;