Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9440711pxu; Mon, 28 Dec 2020 16:38:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaIGOjtT3B6TLVBRMfmR4Qjv1pc1cWKERR5RJWsZ69NQPIvTynxqDsLGuwaCnWPvyWFaqI X-Received: by 2002:a50:ed04:: with SMTP id j4mr45151530eds.84.1609202321443; Mon, 28 Dec 2020 16:38:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609202321; cv=none; d=google.com; s=arc-20160816; b=kVffR9gWpL8vXRWTqun9YF/e9D7hoyn50b4AAz8UYcyvOwCu+1cZd7fG8FgWJFjojM pO2tyvsZpge9hk+7Vm84y/hKtIO4dxFICWl8gUFv4lFsda+6mQPCKUAcy7q3ftybuQI2 4uvH1jsbfDovcJSU+aJzxjBYJWj+ZGmhvqEigSrFv27fdhIYEGFxugr4s2iccOghKlz9 +2Xsc90p2vblaY7JSb3BKvzGWU/RyUgQQAf21LEdQvS5itUg1N/xZLpttwU1hzgSgLMW NOHSsXAaS2QBwYPNki/O1XGeOxqZPoB1iAUX6VBaPVwZihDTn49YkEXqHzVLxep1rfSn +7Pg== 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=YqORDE2S2gEZu9sm1DNnXwQNddS1/4sJBSB6mtcGeZnHnW8CQZ74gdqc96fk6yT09O zWNXSvIgOkXFr1dR8hzA1jVz5li1V9d1qigxzhPoBMG5bxwcV5iY6VEGmK758+Y91MZe TBHwgIY3/reQsytJytAGldWqu5d7N4OcYDkcJKXohiycy9EaZ4gTfa4tZo03OvsXqS0t hweWQtFzR6iWfQ1p/tBKxnoTzDhRpEYli5JG8WG3RDWYTanl2uWRmVBQOlUYCJGvJX1J hUPWIhgLc1JIGB5qyxdhZG/UwPGIRGdhanPjXtqNjgWSlmmIB6IqkokwLxgjGphtIp7K wwuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gkvRF5Wn; 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 q12si21024385edb.395.2020.12.28.16.38.19; Mon, 28 Dec 2020 16:38:41 -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=gkvRF5Wn; 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 S2390553AbgL1PzX (ORCPT + 99 others); Mon, 28 Dec 2020 10:55:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:36670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390565AbgL1NgX (ORCPT ); Mon, 28 Dec 2020 08:36:23 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BE94820728; Mon, 28 Dec 2020 13:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162543; bh=HKVBM16avOEKdjz+NaHmxjroT+xlNi3GmgGkoe+Jq/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gkvRF5WnHRoicggnbSn8Z5XfV/aO+TFRUz5AxCOxovV1wmMBV05+JaJL6BPAS5LO9 W0v6XCvuY8+tcgGw3Ga71YOHhExQhrJOqXktSgcRfYVhj1tabcwoLGI/2It3/xFBXC HVcvmuYr+C90CD0zcXm86HDGPG0mJXrnrTDH/IGQ= 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.19 318/346] spi: rb4xx: Dont leak SPI master in probe error path Date: Mon, 28 Dec 2020 13:50:37 +0100 Message-Id: <20201228124935.164003017@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@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;