Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9411975pxu; Mon, 28 Dec 2020 15:38:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9rI9JE/4ZHuw8BBhEqi3hHQsFiLsq0+MLAenat5aiNYDD7zIc4J+m3qwt9OZa3tMDcBfB X-Received: by 2002:aa7:c44b:: with SMTP id n11mr42976355edr.216.1609198727006; Mon, 28 Dec 2020 15:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609198727; cv=none; d=google.com; s=arc-20160816; b=f66gGpn/FC+IcIlgBYNNDx7OF6ZgDvRL9pcMzHI+28ZnjVGzz02im0EDDppQvkXmyN w+WRxQLf/lJYj6SVSzGFhbJK51xWV242aMzqOpfpkZNlHun0fQZwC5+B6ot2ksxWo9yK +EQuGkPKSIO4iFFsoVxbTAzd5dFpDFT/dWqIB14BnnvbAIh6xT81ASwvz86k6yrHxfvq ysrgmYUnaWUIpZWTavPHHnW/XFw3sJ5ugBcZwzm3q/B7lNjRR1ueQRZhjTT18wg20SCd PAjRfiztYvsOIpnfw7t9B15NixlvB9LA2zG1gninVwnpiutIF/ACuuDjXZd4UCKOWphP 6bmg== 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=geSAAAybuaUCyJmYlk8oWmiF4gMWEDjqddEDB88+/10=; b=CCe29sV1KJKXG7zQM+lGpnmC3D9R0TQDGJwtAD/wAywFYrfxt9vFk9unFynww79aEQ qHOopMfuUPZJZ5wHEb9rQpTBMjiF+hLHyF0UkHJw80zL2qrUmrCdEMCxcY6crRRv7/Y0 2AWE4srZaV7MJ6WvhdUs78VEpAp38LoXb91/of3yUIPKXwR/C/uo7j9hKaAV+flJGjwO LOF1JNwU4/5debKIODnoJy8c4OflIG1ZhE/D2Lte+9y/E7VeZ1l4oQ3Rd0yRhLnDtSs1 vcCqkRXsvtH9DknkkHab10b2jvNgzRHxUKjvF6UmK1BuXMVU4QGDHASE3OFQHuDHlhvj z7Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G8C2qK9a; 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 t2si19451445ejd.302.2020.12.28.15.38.24; Mon, 28 Dec 2020 15:38:46 -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=G8C2qK9a; 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 S2503486AbgL1O34 (ORCPT + 99 others); Mon, 28 Dec 2020 09:29:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:37028 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503450AbgL1O3y (ORCPT ); Mon, 28 Dec 2020 09:29:54 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97B1120739; Mon, 28 Dec 2020 14:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165779; bh=SVczAbKMfCMYD/0DL2Z/KeIitDI4liWOhNw6S+Eg5P0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8C2qK9aseYgq74WeDjs1TXRKhx4GF0aiF3o5wMwAK+pRFIt8/KB112Nq1FezTW8f 2DXy9yxVFY1WaVBdXlQP6SR640ncsbi3Vwn9J5gTkziU/NvUkwWsOLeFKHw8AnA3Xb cXpavfYHbAFyBz7yHu3HGXMFjaSv8Fz6RbBq9E7s= 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 5.10 652/717] spi: rb4xx: Dont leak SPI master in probe error path Date: Mon, 28 Dec 2020 13:50:50 +0100 Message-Id: <20201228125052.188410854@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 @@ -143,7 +143,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;