linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pan Bian <bianpan2016@163.com>
To: Mark Brown <broonie@kernel.org>, Xu Yilun <yilun.xu@intel.com>,
	Matthew Gerlach <matthew.gerlach@linux.intel.com>,
	Tom Rix <trix@redhat.com>, Wu Hao <hao.wu@intel.com>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Pan Bian <bianpan2016@163.com>
Subject: [PATCH] spi: altera: Fix memory leak on error path
Date: Wed, 20 Jan 2021 00:26:35 -0800	[thread overview]
Message-ID: <20210120082635.49304-1-bianpan2016@163.com> (raw)

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 <bianpan2016@163.com>
---
 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 cbc4c28c1541..62ea0c9e321b 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.17.1


             reply	other threads:[~2021-01-20 16:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  8:26 Pan Bian [this message]
2021-01-20  8:35 ` [PATCH] spi: altera: Fix memory leak on error path Xu Yilun
2021-01-20 15:03 ` Tom Rix
2021-01-21  0:08 ` Mark Brown
2021-01-21 18:07 ` matthew.gerlach

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210120082635.49304-1-bianpan2016@163.com \
    --to=bianpan2016@163.com \
    --cc=broonie@kernel.org \
    --cc=hao.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=matthew.gerlach@linux.intel.com \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).