Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8470845ybl; Thu, 16 Jan 2020 17:30:41 -0800 (PST) X-Google-Smtp-Source: APXvYqywDtDA6boaZCvhpWd6FdRv9r+m7adlFib4WDFPyuFVaTnxTmoM0CLDmlQ3uQbIawCHqjjX X-Received: by 2002:aca:c0c5:: with SMTP id q188mr1585406oif.169.1579224640754; Thu, 16 Jan 2020 17:30:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579224640; cv=none; d=google.com; s=arc-20160816; b=sDObDssw5jNgwXNTr70PV/8nja/gLFetZSordNxX+2ewps9IeWcf1Y2NaGMRMP5Rd/ tD3g2jNPgjkW1OLruwWXiBKVwOi6KECqiGguNvgt6C3mtXWYR4P7I0VMqMXZrZoAliLG oG7CfKn+oWQlt4MQGDotACCLKd0BY/rh1Yy0PsTy9ex7CesXb5qGlXbo3qh96NZGNJup 8ptT+wn6juGaXlIMBZr5CvdBVQo6VlHuHMfbXVPB6qODLmPOc0lY6MxW9yO3z3j25Qdm JOlfj4XYYQXT11MZ+WjDkZCje9vMXOB5CkIpTDA3cbCt6sLQppOx3bPONimTf4MUbDIJ uwyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=z/Exke2C/7sUywAnpBam3bHbGoUTU8ndSLU/YHZJYtQ=; b=NbrGYDwQABGUd3ZpNNqYsA64x9PUNRlVfLHttWhtotQnpY0DCbWeufooLOut8cTkWu R1ZfaNmcgORPYCheeezaaFGa4qj6PM0To92B+AFhyLM0KlZJlJhAR32h++tkhfAYG3dw rj1iDna8fyba4YkizKxmYvv8Q2WQKy/BcOkyExr2Z1bQQU1jpgsoJkkGzezQ5EOiDYRO SWkGmQ3sCTbo+IVX25cnwJL/cW5NUVnm/p4/AupDwF2Z6dyFUfHxQTTW8yqdXciMY+hv GZiyjIj2Mo3mKXeU1y+4RKWs56+9n6ktkXcyYaZSKDzxiD9IwsSSbOOPqokROIwVy52S 4anw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uq2r6s6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21si14744024oto.176.2020.01.16.17.30.27; Thu, 16 Jan 2020 17:30:40 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Uq2r6s6X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388628AbgAPX0S (ORCPT + 99 others); Thu, 16 Jan 2020 18:26:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:55984 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388332AbgAPXZ4 (ORCPT ); Thu, 16 Jan 2020 18:25:56 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 0C66F2072B; Thu, 16 Jan 2020 23:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217156; bh=mAeyCEBh9vgKs3MQPtBIK04WIfJU/5gVTaleQ8b0eJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uq2r6s6Xi3iDWdw6wSK2v/P09JDys78ppLpGGOQVRe7G29gEs9X5nTVQRBWX23u/A XRgojo614iXpW8scGU08j5mghrvPpbZ5j4Hgq8fAJRJAcOG+ov4I6nuVHs/2SQpLbM EDhgIehzZPuN1Fg9ZuESJDHTgT62NfmfuNwXrreg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Mark Brown Subject: [PATCH 5.4 171/203] spi: lpspi: fix memory leak in fsl_lpspi_probe Date: Fri, 17 Jan 2020 00:18:08 +0100 Message-Id: <20200116231759.502270087@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Navid Emamdoost commit 057b8945f78f76d0b04eeb5c27cd9225e5e7ad86 upstream. In fsl_lpspi_probe an SPI controller is allocated either via spi_alloc_slave or spi_alloc_master. In all but one error cases this controller is put by going to error handling code. This commit fixes the case when pm_runtime_get_sync fails and it should go to the error handling path. Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi") Signed-off-by: Navid Emamdoost Link: https://lore.kernel.org/r/20190930034602.1467-1-navid.emamdoost@gmail.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -938,7 +938,7 @@ static int fsl_lpspi_probe(struct platfo ret = pm_runtime_get_sync(fsl_lpspi->dev); if (ret < 0) { dev_err(fsl_lpspi->dev, "failed to enable clock\n"); - return ret; + goto out_controller_put; } temp = readl(fsl_lpspi->base + IMX7ULP_PARAM);