Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9180337pxu; Mon, 28 Dec 2020 08:34:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyieRaHLD6XlL8QO4bJM31AH1NFssLiX+fkZ+12dSH9O+rK7l5JqyM8V4xrFxAA6fhluOi7 X-Received: by 2002:aa7:c7d8:: with SMTP id o24mr43376739eds.328.1609173271053; Mon, 28 Dec 2020 08:34:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173271; cv=none; d=google.com; s=arc-20160816; b=SW/yaVCwog9cUFTuWXc9lcXKHYLtbVPW2uNoYV8qn0earmtKJH2aSYxkvO1/M/3g+p u8ZNh8jj9VzZkYWXWi7JiB5G+X0THxkiMoS6u+wrqZNfggqyzkJrxHmgtP2dQ/k6aIR/ rrZmZWKchAj+EQDZwLCww0M3QCCnq9HpvfhK/3tAbmv75KYn5WL/petMLw8AMSHsLzug 7GYy4koGuFloiKO7Q+GB9ZM7PP5L6Q6pzFh+UUdvXKM+z9VueBUhgaL4/UuVq6CagshU d7FariHK8XscHMFIcgOYjKYJINbOKtc/m6Op5yBCvDfM2WqA2BSsaum+PCd3oWeA8KHL H2UA== 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=tOMPRbTsMLfxAOn/iPCiPywqQ+slWiT8RBKpKyTDM+8cZxF/bAzxtAqtk3PrMxGomf e/Qy3S6d5F+Tg1L4S7fCzpV1X9ngMxu4P71N3hnAOIKLmetP9fRRAX2401AcLo7qKJxP cMO2pmXy2eLvZFFiP/gXDfLdl6mXPyu3N0Hh9R+xiP8cJ5GpIyMKRJRwG45kDmMzOFDl qWC4C19n6uE0Lw6H2JVIQceUCzD0bdnr6YMqSfj6/EhsAeRlUOpRDBj3/CxPXMzerbBV QSFq1osqXmF69y+dPc8BxofoYLGOaCQuSf/vmi9wra6ZdKQcCkCV8bjMQdu1+w1aqueu W9HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IM9jtQWp; 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 s2si20386227edw.5.2020.12.28.08.34.07; Mon, 28 Dec 2020 08:34:31 -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=IM9jtQWp; 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 S2633687AbgL1Qaz (ORCPT + 99 others); Mon, 28 Dec 2020 11:30:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:33926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728574AbgL1NGY (ORCPT ); Mon, 28 Dec 2020 08:06:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 298D8206ED; Mon, 28 Dec 2020 13:06:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160768; bh=HKVBM16avOEKdjz+NaHmxjroT+xlNi3GmgGkoe+Jq/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IM9jtQWpRnoS5Vo+eVgySK8AzUCOUHdEu6YGVM31bTP0DUBfWGu2MC4u32tnf8zwB 18HwGM4GBz0zNWrgslyPiJmL3szQugTM45wcYD+Ya/rQhaXr2F6OCmmEkV1H6hxl+t Iqs+7jTLDVbHhTm1dQ6SuXX9hW+B6UZGQjNvP/eU= 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.9 165/175] spi: rb4xx: Dont leak SPI master in probe error path Date: Mon, 28 Dec 2020 13:50:18 +0100 Message-Id: <20201228124901.233708312@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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;