Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp726065pxb; Tue, 2 Feb 2021 16:49:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6TTeEgIm4J3ArKB8KdoBQ4FnExOOAib0YUmr6m452yOCbLBEEJmngBrirMyEtOq3lqgrp X-Received: by 2002:a50:b5c5:: with SMTP id a63mr622157ede.227.1612313391852; Tue, 02 Feb 2021 16:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612313391; cv=none; d=google.com; s=arc-20160816; b=byNVH9zMEqOo5C3oq4gUGbvuGmoh1uNg2GWz7nd2O/UuMKoVuyyk7s+HjGyTyYcQv/ LPfyuGdDh2yY+H8Ibrhm99JZuzC1sGzrrZibr/8VTxQFraezMnfMuhdediJlUjIb3gAb gCVCrj08sJVX76k1OuqM6ykERudEACsIZ/yF3lLtPAostRWCABUhaojlWVfPOX5r4A1N JGEG+21Qc76joFs1X6lUkgj98hq0BSZQP7dZMVqXwbAVRU58Pa5zqjzhSS4gZdrr/I9N d5ZkeHwPjeIE5tEpKO40hoUc5KcsNE7Mp306GwERicSCGEY2I7VDZFM21bHs3dZ6btxI QvxA== 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=dTp77X5hjQvuD2PzA0UyuMN/+5+3dE5yeVnElSLCVbk=; b=liUCZH2uOZZXMMD+OQzr/FkOFTEvAs4t3V6PiS1asAZeKlb5stAcoi8gE6QW/r6COY v6xGyEtNL04oSp7b+4XLFiDY4TTu08nfNTM+NckK0d6spHjqbxVDDxTzgLBu81yVbyN6 bOPHoIp42ME+omCFUtFKEvWao9LgkRYDb8H9lwCtd+MylzA3mjwCl2wsA7jAN8ruJoUb 2/T0oaznlziYAmFQekJ4SX8onNXVPxK42u1LV9a58HOR/CdClVvusV2J1UWFrOU0TBGU s8hU+IOdNk4783cBPbGHGPwejSxsZj2cvvNeUooF0YjURT9naPw6fn34x59ZE6GIawpf woJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=1XRPRkf7; 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 cs10si284608ejc.200.2021.02.02.16.49.27; Tue, 02 Feb 2021 16:49:51 -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=1XRPRkf7; 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 S240052AbhBBTve (ORCPT + 99 others); Tue, 2 Feb 2021 14:51:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:42400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233142AbhBBNwD (ORCPT ); Tue, 2 Feb 2021 08:52:03 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E0D764FB8; Tue, 2 Feb 2021 13:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273402; bh=/gKE9i7us46RTrDmQyLDLmsqv04nXLnLT5KpJ4JXgso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1XRPRkf7TpBKTxkYM2L+TK1Z2qvkJByHS3zTFMp9KJkDgRiBMDOMETktV/TY90Mw7 ABZwM7iWsdvM+V/EwAiPoAli/86Teb1WqJgjpnkCtBLy4BTkah3lUiy6HmuwVB/bHN rY/eNx/NzAHsvmMUnIUIxuaW5tJvOeqnU+iuYgUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , Tom Rix , Mark Brown , Sasha Levin Subject: [PATCH 5.10 093/142] spi: altera: Fix memory leak on error path Date: Tue, 2 Feb 2021 14:37:36 +0100 Message-Id: <20210202133001.548881247@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@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: Pan Bian [ Upstream commit 55a8b42e8645a6dab88674a30cb6ed328e660680 ] Release master that have been previously allocated if the number of chipselect is invalid. Fixes: 8e04187c1bc7 ("spi: altera: add SPI core parameters support via platform data.") Signed-off-by: Pan Bian Reviewed-by: Tom Rix Link: https://lore.kernel.org/r/20210120082635.49304-1-bianpan2016@163.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-altera.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-altera.c b/drivers/spi/spi-altera.c index cbc4c28c1541c..62ea0c9e321b4 100644 --- a/drivers/spi/spi-altera.c +++ b/drivers/spi/spi-altera.c @@ -254,7 +254,8 @@ static int altera_spi_probe(struct platform_device *pdev) dev_err(&pdev->dev, "Invalid number of chipselect: %hu\n", pdata->num_chipselect); - return -EINVAL; + err = -EINVAL; + goto exit; } master->num_chipselect = pdata->num_chipselect; -- 2.27.0