Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp829591pxu; Mon, 23 Nov 2020 05:22:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTjS05GkdH3StvpTLbkz7Tml3EQQuxlPhikUtKYFTrC37GFoO01iTbiKCJqjDok5Ums/nL X-Received: by 2002:a50:daca:: with SMTP id s10mr39058697edj.263.1606137778876; Mon, 23 Nov 2020 05:22:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606137778; cv=none; d=google.com; s=arc-20160816; b=E2/xakQdmVTblv3fPWeLqfVQj1DX6ecj8ct0Gvv1XPGl/Bh3D68tMJUQojKw9qdeQR zyupDPswnQcnRJg0W1YB84WZZqj/PIu0sVtg0j8ty6dY88lyG6PKq4Sbec1+ksXyGRnW Imknk6ydi9Jb/7cZ+Num3nucPNjPaEqq8qD5MU7Jh+8Z5uxG4LQASa1Riagc8QMsoFft Fi3ekf4CHZL7xc609ZmKmQ9GwSV3L8fUrJtvfFxytWvysutSN7Skk1er9Fb+G6+jsuvT /MN0+JAX8twNou74/vv4bT3ff3gOSnzaEojaunxcWu1w3LrjKV62DWzLRo1EWDfm1BFN qUAg== 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=iy1l/EtEYyXRoBIa5WmLzC1oMzCBS43cQoBH3g15B7g=; b=uxTv9Qf6AIlWwjQ0mDdtqxuty7igax5lVpgS/RHte/sUdnZpfRMidGX5ImoUnmEtX+ RZuI2jbuUC9DiAahoCgNPgN2ykneMRJbYtFo5Fv5PVwbSdjg0NcKFPUogxaRyiC0+Pux 6ni5vm5cp8XYTejqPCT7PyYZiqFgFGXZmBG3RQUxEYebNhGCu/BgP/VMRl6zw7RUvhAA JNm36uh6dVFqwTSc4L8qwUkEbfqwchuWmxSCccWIRnUtx7QyO2jZCJLtCe6s2i02bJGB EPrWuqd7EFqqVxNvy9iAky7IfeNZlVlgGa6AY7Fh4Vwc5cBQ1XHFGtnpuZSnUHk74xLk PZMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qL4v3MVM; 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 bu10si4080349ejb.483.2020.11.23.05.22.36; Mon, 23 Nov 2020 05:22:58 -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=qL4v3MVM; 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 S1732336AbgKWMju (ORCPT + 99 others); Mon, 23 Nov 2020 07:39:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:52336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732324AbgKWMjn (ORCPT ); Mon, 23 Nov 2020 07:39:43 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 30D082076E; Mon, 23 Nov 2020 12:39:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1606135183; bh=zhvzN87Fa32w8zG5NZxmYcOn+hF5t93T3wTMiQDu4+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qL4v3MVMX3ch7uPmeYkmWLwwPyBtFB5WOBMp73ro5wY5O5xus4L6+CU3NJwV6/KwF cPLldAywzpGNe3XLaCjdjTQQksrJlG9Wi7FjgcDcC6TJA7Fg8I+FMZtw2xK96NDlOq hNeG4ZHya9wpoPfYxewn+yUmElq8+JYcpeMxFM1I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Tomer Maimon , Mark Brown Subject: [PATCH 5.4 135/158] spi: npcm-fiu: Dont leak SPI master in probe error path Date: Mon, 23 Nov 2020 13:22:43 +0100 Message-Id: <20201123121826.444823000@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201123121819.943135899@linuxfoundation.org> References: <20201123121819.943135899@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 04a9cd51d3f3308a98cbc6adc07acb12fbade011 upstream. If the calls to of_match_device(), of_alias_get_id(), devm_ioremap_resource(), devm_regmap_init_mmio() or devm_clk_get() fail on probe of the NPCM FIU SPI driver, the spi_controller struct is erroneously not freed. Fix by switching over to the new devm_spi_alloc_master() helper. Fixes: ace55c411b11 ("spi: npcm-fiu: add NPCM FIU controller driver") Signed-off-by: Lukas Wunner Cc: # v5.4+: 5e844cc37a5c: spi: Introduce device-managed SPI controller allocation Cc: # v5.4+ Cc: Tomer Maimon Link: https://lore.kernel.org/r/a420c23a363a3bc9aa684c6e790c32a8af106d17.1605512876.git.lukas@wunner.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-npcm-fiu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -680,7 +680,7 @@ static int npcm_fiu_probe(struct platfor int ret; int id; - ctrl = spi_alloc_master(dev, sizeof(*fiu)); + ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); if (!ctrl) return -ENOMEM;