Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2621462pxj; Mon, 31 May 2021 06:46:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1vcZeJwxT2DcfEs3gkse2CKEgEQ1Y7jqnLULD6kWsQWkmCvG9fuBLSHCFipdeq8+D+4CE X-Received: by 2002:a5d:818b:: with SMTP id u11mr16911436ion.36.1622468764358; Mon, 31 May 2021 06:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622468764; cv=none; d=google.com; s=arc-20160816; b=0M4Ku3Cjer26gA0GxtpdXZUq3XnlEJDS8yHDw+n3hCvVKJzUMUu79zFC33V0yeend/ swXVLBmo0+b39SsqPsHgT7VuZ74tNu8TnqE5813zY/vCnPnHqMctpraE8+B6wHEbAzLG 9EqvzTDG+iYO8x9aOpx9El/AcXMZ6Yd12pkGsQCgm79t9PdzttI55A+1lV9Zjc8slsdM Z3tXxt/16j9LbSQpElLcKu7T2nNCH0tzKdek7jkb4P16/oMk7ozQL62NepYC0gMvOhX4 d7eNshjV0CVsyP29woBu9SekBWMMDa1hVBd6g7UM9ZsclqyrZWDUzOalh7ILJ4fIoxpn J4sw== 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=QeU7iimHSVYvtGe+V03Mg0yWF6WQnwMB01xOj0McSdw=; b=jyv+XUEqtvw6bhCJfrJggr5IWbnvWohrJ9ifgL88JSwRThKwJTGMbNFrLIJ2EyRqvj 2yAYIS6W7heSqvlgfP9RGP01MwV6AnGGx4MAanqCkde3R6c0wFnFJbu2hG5YhousunVd oTdFLZlLSLB8GMrf5HgKKF0IzC5Y4HeAqoukLkl+AFDEAs9WHtAoJcGnSGoQMDxqCNNK fKRglvbvKgvSCAZnRS7Nx4ya6dRyf/B607tenWdbUN8nNwAT6Kdzvdd60K/b7aus2B2h DOpRU5Qbytf2HBx2wjudBNFblATKxHFa2e4QehSUwE+gTeIIHr0223ZY24eXuG704OPo AKsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=f4cXBhsK; 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 g3si9885791ila.154.2021.05.31.06.45.51; Mon, 31 May 2021 06:46:04 -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=f4cXBhsK; 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 S232291AbhEaNq0 (ORCPT + 99 others); Mon, 31 May 2021 09:46:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:39376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232388AbhEaNbc (ORCPT ); Mon, 31 May 2021 09:31:32 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BFD1B61432; Mon, 31 May 2021 13:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622467427; bh=nnoVf5A9vs+dxKUhBfxsHFDLJkya+4vCJ8gyjvA8ur8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f4cXBhsKuC69O1xHnCsaF2I2F8YqGKssXkfLGt98yNhcXTs1cuB3pRNg4oL4bQUq2 zOFd7uNe0UynEJ+kVKCZOY+vIrv/Y2otXRUjWgBX+73wIVMIvq5WRuVGEX0VNNjXI9 tHIMYjXDzxdPRD01XV0IpQEHcAKoXKOkVgcJJVs4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Qinglang Miao , Mark Brown Subject: [PATCH 4.19 060/116] spi: mt7621: Disable clock in probe error path Date: Mon, 31 May 2021 15:13:56 +0200 Message-Id: <20210531130642.207493188@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130640.131924542@linuxfoundation.org> References: <20210531130640.131924542@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 24f7033405abe195224ec793dbc3d7a27dec0b98 upstream. Commit 702b15cb9712 ("spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe") sought to disable the SYS clock on probe errors, but only did so for 2 of 3 potentially failing calls: The clock needs to be disabled on failure of devm_spi_register_controller() as well. Moreover, the commit purports to fix a bug in commit cbd66c626e16 ("spi: mt7621: Move SPI driver out of staging") but in reality the bug has existed since the driver was first introduced. Fixes: 1ab7f2a43558 ("staging: mt7621-spi: add mt7621 support") Signed-off-by: Lukas Wunner Cc: # v4.17+: 702b15cb9712: spi: mt7621: fix missing clk_disable_unprepare() on error in mt7621_spi_probe Cc: # v4.17+ Cc: Qinglang Miao Link: https://lore.kernel.org/r/36ad42760087952fb7c10aae7d2628547c26a7ec.1607286887.git.lukas@wunner.de Signed-off-by: Mark Brown [lukas: backport to v4.19.192] Signed-off-by: Lukas Wunner Signed-off-by: Greg Kroah-Hartman --- drivers/staging/mt7621-spi/spi-mt7621.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/staging/mt7621-spi/spi-mt7621.c +++ b/drivers/staging/mt7621-spi/spi-mt7621.c @@ -487,7 +487,11 @@ static int mt7621_spi_probe(struct platf mt7621_spi_reset(rs, 0); - return spi_register_master(master); + ret = spi_register_master(master); + if (ret) + clk_disable_unprepare(clk); + + return ret; } static int mt7621_spi_remove(struct platform_device *pdev)