Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2201446iof; Tue, 7 Jun 2022 23:03:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy4Czf41dyNQsHEvEdYvJdENUz30OhE3Bkj8lRQx8kalA0Rbca6SUXkNzmir4JOKuB4nf0c X-Received: by 2002:a63:b55:0:b0:3fd:a384:bd10 with SMTP id a21-20020a630b55000000b003fda384bd10mr13869617pgl.534.1654668196139; Tue, 07 Jun 2022 23:03:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668196; cv=none; d=google.com; s=arc-20160816; b=wsr2g46N/GXYuYvvFJ0zvDmahU52vYZcwhrYnVkURVL9HSmAjEcmOnfKS1VI21cFkR X/2oP/CeIpxsbaIPfi/+3Ksgmdn5XUqu4M8oZNL3HBZBQWgUoS54OFfH6AK+RgW89nNS QwwPpJvGcYzaOaPQOo2NTTo7NTzujnsXDXpFpVngKEI+mk4gIsuJxpkFg1K9B31ltYwy 6+1QMJn+kpadzXvdDlN/e9uKo3CWh520aigiet9TKuhK5A5Aist6Un6I+03jmC1iVz3q f2uXyMJPo/OEjskTKCrbov6l92MiH0fiQ99+VI2RtG5osXsPX1DwpZFXZqCY/BmVnuXw Vqvg== 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=KqNpZ6se+sZKr4Fxco5/4w233J1JoNYgfef8WLsKHcQ=; b=UfYajN6xlYgHggPNinDxmYEv3EKXa++NB4UogzRTKKJHeRJnzG5KDZH64V39V7vFIJ iFnvAIf3jFgzVpVJyDqmw+pytsPbOnRyOmH6MpJbNMKduu59X4FtA1cq5K46miqIWgz1 9ahNa5u/DDOZhQ+8QR+F2WYMMTy0l+O3goad86588ienZJfYlOfqIWD2IPR0tFn9GNGY ZQSxtQX3DYv5Xi/rE/itFzfrPiWp/1/lLJoPXW26GHMDmaQAGDaadTXhcvIwI97omS8F Pwv5zoOTK93rpe8rPrV1savBs5VSpbgwyP6DkCNa1nNyIISbLyuNOufasO2/wOoG3MgK 2ing== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t5C5RphS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id pg5-20020a17090b1e0500b001e887404411si11996427pjb.8.2022.06.07.23.03.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:03:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t5C5RphS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 35325458AE5; Tue, 7 Jun 2022 22:28:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384678AbiFHB0A (ORCPT + 99 others); Tue, 7 Jun 2022 21:26:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383749AbiFGWGP (ORCPT ); Tue, 7 Jun 2022 18:06:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA1AF1366; Tue, 7 Jun 2022 12:17:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2949061929; Tue, 7 Jun 2022 19:17:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 343E6C385A2; Tue, 7 Jun 2022 19:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629436; bh=/fej+mXE9IrJnCoGX4AW8AzyF2M8v1cIvlXyCB/f208=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t5C5RphSGM64LPF+KyI/OhhxvGh0HVorQSOgaTfL/63/r0lXILSYZuVbFZsGqnwpb qpgvvO384HF5pqnWtx/q7CHJe65WIqg8+ilJSlFpmKCZhotssC4hmQdlYfNxkMrx9i EwnuK/hAWiQ331PmxF61sMZ3ryY3HjpmPCuxS5Ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kuninori Morimoto , Wolfram Sang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 691/879] i2c: rcar: fix PM ref counts in probe error paths Date: Tue, 7 Jun 2022 19:03:29 +0200 Message-Id: <20220607165022.905400150@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kuninori Morimoto [ Upstream commit 3fe2ec59db1a7569e18594b9c0cf1f4f1afd498e ] We have to take care of ID_P_PM_BLOCKED when bailing out during probe. Fixes: 7ee24eb508d6 ("i2c: rcar: disable PM in multi-master mode") Signed-off-by: Kuninori Morimoto Signed-off-by: Wolfram Sang Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-rcar.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 0db3d7559066..0064c632af5c 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -1063,8 +1063,10 @@ static int rcar_i2c_probe(struct platform_device *pdev) pm_runtime_enable(dev); pm_runtime_get_sync(dev); ret = rcar_i2c_clock_calculate(priv); - if (ret < 0) - goto out_pm_put; + if (ret < 0) { + pm_runtime_put(dev); + goto out_pm_disable; + } rcar_i2c_write(priv, ICSAR, 0); /* Gen2: must be 0 if not using slave */ @@ -1093,19 +1095,19 @@ static int rcar_i2c_probe(struct platform_device *pdev) ret = platform_get_irq(pdev, 0); if (ret < 0) - goto out_pm_disable; + goto out_pm_put; priv->irq = ret; ret = devm_request_irq(dev, priv->irq, irqhandler, irqflags, dev_name(dev), priv); if (ret < 0) { dev_err(dev, "cannot get irq %d\n", priv->irq); - goto out_pm_disable; + goto out_pm_put; } platform_set_drvdata(pdev, priv); ret = i2c_add_numbered_adapter(adap); if (ret < 0) - goto out_pm_disable; + goto out_pm_put; if (priv->flags & ID_P_HOST_NOTIFY) { priv->host_notify_client = i2c_new_slave_host_notify_device(adap); @@ -1122,7 +1124,8 @@ static int rcar_i2c_probe(struct platform_device *pdev) out_del_device: i2c_del_adapter(&priv->adap); out_pm_put: - pm_runtime_put(dev); + if (priv->flags & ID_P_PM_BLOCKED) + pm_runtime_put(dev); out_pm_disable: pm_runtime_disable(dev); return ret; -- 2.35.1