Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp1838372pxb; Mon, 13 Sep 2021 06:40:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwP7yK37AynvlJR3yb/fO5T1pf1yTC/6Yp0cUqL5Ee0vqBjziOfWvEXGamy+f3O08Sq8gk8 X-Received: by 2002:a05:6638:140f:: with SMTP id k15mr5537786jad.113.1631540403547; Mon, 13 Sep 2021 06:40:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631540403; cv=none; d=google.com; s=arc-20160816; b=V9tx8cOx5XgwWLdHLxLIHWmJxVESSe3w1DctCba2UoKXHnhxUV0LmOZBMpQHEl+LNt GjvaoYeYklH6AWF+GfDCwHquS+WJFxYKj7ni3KeFKXlui294vYGDVzYvb5U4Q28uU6fZ XPz5WajBKn74PYc+J/KTcS5JzQnZ78tYCK1GVJRxVE/47npmOMoJJ7quQuDXzKup6Zu6 LDjOHngZWZiVSMAEz7FHHEp8Si78bHDlebqN53sZOSSnOQTMe7Y6HTM5H2e5o9rdNTkj 4ETLBH0cP3p9y4wyhJLVv9YQK1bscjSpsT+7SgzYd6EUgJebw6zuQ2T/W3+w/q6vkRPs wS0g== 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=D8grX4DpodYuznnUWK5T24XR1aWieI1mFbsftEg55lM=; b=L/vCT+pp80a8BJ1krJIP5g5T8WwR1wUpTWQj1D0Yn0EcxSdET7PHQRgLumJm9SRgTp RPJnxC5D0w5x8ydanbCqyW4E3TOeVWi/ETSmYfeDforrAcu3j33fzSKzownwH1LGRs1Z 6MV7t0LoPwTkNLK9rz/4VwwKSKBO8cvrwMlplq0sO0/Ajoqp5ZteSSFN+ddC8SlMgqTC YAyk8lpYpQUTGd+zdqqRf59YmP59b4FWk+Q3EAOFtqZHuqnmnpV55iNhtvyx6edn/F5E PJzHn5VvVOGFKg99bCrrzIdtBxANMP5VS1bbCfUBzhXXgKu6qzhhfSOmxIGtiyeKpyJb Ohmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LcuGjleX; 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 r199si749286jac.71.2021.09.13.06.39.50; Mon, 13 Sep 2021 06:40:03 -0700 (PDT) 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=LcuGjleX; 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 S243507AbhIMNje (ORCPT + 99 others); Mon, 13 Sep 2021 09:39:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:52402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240288AbhIMNcv (ORCPT ); Mon, 13 Sep 2021 09:32:51 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7406861381; Mon, 13 Sep 2021 13:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631539568; bh=QlaMXaMRG+4kSqbA/r2yAL3RAmk/iIhRCJraJNbA25A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcuGjleXNJyy8VbCrBRd71BDTmQtMU3D9loGGc/0QAPX0uo71HiYSvceMJeyi0AUh OlXFB5RFyo1T7G2b6ZIZ5lheq4qxrFDU9waCcRu26IqscndOE33Wz2zzkzfeuSHJM+ zm3gjrAGa68nJLUoHV0k/nXP3jWmWd452Y/+7lwo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 075/236] media: cxd2880-spi: Fix an error handling path Date: Mon, 13 Sep 2021 15:13:00 +0200 Message-Id: <20210913131102.917636134@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210913131100.316353015@linuxfoundation.org> References: <20210913131100.316353015@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: Christophe JAILLET [ Upstream commit dcb0145821017e929a733e2271c85c6f82b9c9f8 ] If an error occurs after a successful 'regulator_enable()' call, 'regulator_disable()' must be called. Fix the error handling path of the probe accordingly. Fixes: cb496cd472af ("media: cxd2880-spi: Add optional vcc regulator") Signed-off-by: Christophe JAILLET Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/spi/cxd2880-spi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c index 4077217777f9..93194f03764d 100644 --- a/drivers/media/spi/cxd2880-spi.c +++ b/drivers/media/spi/cxd2880-spi.c @@ -524,13 +524,13 @@ cxd2880_spi_probe(struct spi_device *spi) if (IS_ERR(dvb_spi->vcc_supply)) { if (PTR_ERR(dvb_spi->vcc_supply) == -EPROBE_DEFER) { ret = -EPROBE_DEFER; - goto fail_adapter; + goto fail_regulator; } dvb_spi->vcc_supply = NULL; } else { ret = regulator_enable(dvb_spi->vcc_supply); if (ret) - goto fail_adapter; + goto fail_regulator; } dvb_spi->spi = spi; @@ -618,6 +618,9 @@ fail_frontend: fail_attach: dvb_unregister_adapter(&dvb_spi->adapter); fail_adapter: + if (!dvb_spi->vcc_supply) + regulator_disable(dvb_spi->vcc_supply); +fail_regulator: kfree(dvb_spi); return ret; } -- 2.30.2