Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9102039pxu; Mon, 28 Dec 2020 06:41:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrtg1g2WUu9YhM2BnM+DYTAB1Q0temTX28CxSSPWgIc1wWM94eUI3tMqou22l9k/AgfmMY X-Received: by 2002:a50:84a9:: with SMTP id 38mr41787743edq.378.1609166480019; Mon, 28 Dec 2020 06:41:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166480; cv=none; d=google.com; s=arc-20160816; b=oBYPl+Ju6Lmi/lh9QTKEG0dCDabQM05FCMpOVsJJ5QJQxhS5RqbmC1MeKxeVx90sKd rvKOnf4u88MVG3p9bY5JBiJaODlHgmfpc90gQKbTgXxJ6x52wPcsOZHG3ZMb3SYitWkn eBRqIhq0wPNV8k05aSeOkL8p0gnpEGeuuco3MgJH74gfyzMLvBQqWAEuiJoTyUJukuHA Ez7m07qTM6oaknesXfSQFNWruw/hl2Fxae7aGbSmuz15UXGXi093tf7INfw4mcvh4+Iq n0x9+BXZTy8TMUlZIspNmw6cJogjROujNa65ZXYwgw31iXtNrsH6gjO9LrWzXt757xi/ j6Hg== 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=VlT992ILh6axq2ExTkwFRzM3YlSsYJ1ym3PN8WSln08=; b=W5ExZvu0K6C9acT11OqKwp5ReTTlflw1wdf6Rpr66yjBaXeiYWj+Z1OMQH8ELnIwZA SfUA/wyOP9zqKHD/unLG/8ci8+IOGTozSjlXtS6MJFhtvcaISIew6rZPw01aNGwtG11C 1iRTKqTt2/w/81ZpKriXv54Wm7ZSREkjMLHpRHuirIT1m6NeWDkIoB7oktL/GF44wNLv /S+kfUZNAkGzle3RxlgyTSZ8oKT+BIyDYG0pReomx9eulvbBJikyXO4fX+5fRj3pP4vS cFBYhtmkM9jdeLiKKS+QxKtkY4lzdyEmX69EjVAQgEEufw/EVpPqVUe2njFEP1BK6o7z Fipg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=08+NItAL; 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 gn22si17919719ejc.749.2020.12.28.06.40.56; Mon, 28 Dec 2020 06:41:20 -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=08+NItAL; 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 S2505667AbgL1Oiq (ORCPT + 99 others); Mon, 28 Dec 2020 09:38:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:39952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392093AbgL1Obo (ORCPT ); Mon, 28 Dec 2020 09:31:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 26E9820715; Mon, 28 Dec 2020 14:31:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165863; bh=LOnALXAwccCD9RXii7ICJ5jy51cug5E67HC3V0KiZps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=08+NItALbpZjAf/OcZqrbbg6EyuV7UAfUnVdzjrkswTp9Tb+aAgUDGyp6Xf95lvUV Wkb1jc7c/iE025GV2CvJNILU3k9aNFj3Q5ST9WSHjxoelwIGf90qYVQhAgLPq8YqwU gCC1PE4lP3xrY25E0R1GOQICwRuZueOXEFmtHD5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Tomer Maimon , Mark Brown Subject: [PATCH 5.10 650/717] spi: npcm-fiu: Disable clock in probe error path Date: Mon, 28 Dec 2020 13:50:48 +0100 Message-Id: <20201228125052.090332666@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 234266a5168bbe8220d263e3aa7aa80cf921c483 upstream. If the call to devm_spi_register_master() fails on probe of the NPCM FIU SPI driver, the clock "fiu->clk" is erroneously not unprepared and disabled. Fix it. Fixes: ace55c411b11 ("spi: npcm-fiu: add NPCM FIU controller driver") Signed-off-by: Lukas Wunner Cc: # v5.4+ Cc: Tomer Maimon Link: https://lore.kernel.org/r/9ae62f4e1cfe542bec57ac2743e6fca9f9548f55.1607286887.git.lukas@wunner.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- drivers/spi/spi-npcm-fiu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/spi/spi-npcm-fiu.c +++ b/drivers/spi/spi-npcm-fiu.c @@ -677,7 +677,7 @@ static int npcm_fiu_probe(struct platfor struct npcm_fiu_spi *fiu; void __iomem *regbase; struct resource *res; - int id; + int id, ret; ctrl = devm_spi_alloc_master(dev, sizeof(*fiu)); if (!ctrl) @@ -735,7 +735,11 @@ static int npcm_fiu_probe(struct platfor ctrl->num_chipselect = fiu->info->max_cs; ctrl->dev.of_node = dev->of_node; - return devm_spi_register_master(dev, ctrl); + ret = devm_spi_register_master(dev, ctrl); + if (ret) + clk_disable_unprepare(fiu->clk); + + return ret; } static int npcm_fiu_remove(struct platform_device *pdev)