Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1248821pxb; Fri, 22 Jan 2021 10:31:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJznYLW9RLTIMfJBNJswJ8OZhsztr+YS303uthwA6IA2PGNIXXHurlCyzeE0ukKLGa+xwe8m X-Received: by 2002:a05:6402:40c4:: with SMTP id z4mr4183983edb.233.1611340274508; Fri, 22 Jan 2021 10:31:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611340274; cv=none; d=google.com; s=arc-20160816; b=GIP5ocKeX4xyeVD96awaQ1nFIruWj4Hyo6P2lJrL3gKhOng6lmuVi4rCvDupOvx4Aw pF24lDU+nxqTHa5yuHhYufFSlPQ4pGETH3CvEXpvydCoOFyX/m6kx7CcJyQwjv+xm8vD 7EMgznR7WFP3vryk5CL6sv/kE2Z4F8F+p8aBnDUSPeBYRtI2m/x9fWyhWxHgX56VMr9X 2HNGKyBkyiYHvMex5krfTDcnaPb5sIiua+2Lma1HWgRzHv4Hu+t04LJMdUiWMtN5ljCs 3fkPoas+Msk4v5Dd4g1O45agKyx5MCKfbuhoHVUOLiX3eMQfpDQGQLWNT+241diEntsp paHA== 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=02QsjcpVxWnzrumgzIfTIMpYsGDMVI/VMiGRKoB8tao=; b=KOaYC0pu3r+ZG/OwM0R7DFpcySPQguSEPvV7OXKsFxPfIwhm+D1ufUNk6QJ2JXF5VX cijgPmqAJfK7VJt94aWRm5g2dbNtwiU+HnZlVC1dAT0lea/W8cK3zGVXXNfP72om5eWj st4WUCHmloJ3u0AAp4OpLmXMDtop2PA6Lwjv0KkMdv3PfxDSfeKChjWaw4Rk4UCP9pzQ VPmFVtekS4N0g9U8+OnOzTYnehqZZpLLSeH442WI7xQSeW7fEAzywjdBGLXv/T9q6+bD sSEX3hyADM2fCJ8NjBpDmVbhnoc+ewuFkNgypsCRdTt/5gsnJ/CcHCIps0mls1n5yqHh VpcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RhAzHZCg; 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 pk20si3225082ejb.103.2021.01.22.10.30.49; Fri, 22 Jan 2021 10:31:14 -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=RhAzHZCg; 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 S1729988AbhAVS1m (ORCPT + 99 others); Fri, 22 Jan 2021 13:27:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:39964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728573AbhAVOXA (ORCPT ); Fri, 22 Jan 2021 09:23:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FFD123A03; Fri, 22 Jan 2021 14:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1611325025; bh=cG9JyASyOeTvySf38gpC0E17w5y4mK5r8LNBvZZPkk8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RhAzHZCgjlR+hFKKpL7cg6i4n7JnK7m87smfaaKJKL6MFLGXsV6zwhk5emnL5HLDh 9M3uuEW6Dcmsiw/uK78tR2ECBbSd2Dxkf6KevDwnpOvsOkXIYG+w49XBh+MtWwGf36 0G3mlc8gw0LwaRbCEAgdcpqOa4FaYlBve7ehnyIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Tomer Maimon , Mark Brown , Sudip Mukherjee Subject: [PATCH 5.4 08/33] spi: npcm-fiu: Disable clock in probe error path Date: Fri, 22 Jan 2021 15:12:24 +0100 Message-Id: <20210122135733.902351505@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210122135733.565501039@linuxfoundation.org> References: <20210122135733.565501039@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: Sudip Mukherjee 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)