Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp814276rwb; Mon, 26 Sep 2022 06:15:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kNaFtjcZq2+4hJnDX5cGnG7836JJluKBHp9YgAvQ1ttO+hZr38ONESWywpIsjiWAJ397v X-Received: by 2002:a17:903:32cc:b0:178:3d35:dfc4 with SMTP id i12-20020a17090332cc00b001783d35dfc4mr22516610plr.116.1664198150170; Mon, 26 Sep 2022 06:15:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664198150; cv=none; d=google.com; s=arc-20160816; b=HVYvgebGa1TCV/lYcReYduYT9HH68bL2bith0StWSD5zGd16PUDy8eCKUtJNFfve79 HFt+QQuiHpCSSXqU7JFCGe8UEVIVazdVlgbNgTiy3SD3T9NWJd63TS2Tx/MD22LYUmUk sSh+URsUKA8QKEGlJIR6e5kuAY4X52kdQqjkj8D/cwtvkkp+tS/rlszCtUL/3I6AwxVc ysnfZH811eDKybATueq/kUY3wbM1lZv5IufO26TEsgKcbXQSQzg0wX1mpsyJ+dQz1tw1 Nh6DNrKz6MXEnIQFAhREWRLcneQDGfSFIEFyk40tFtRP7WpLy+6tYh7zvAPF5EnrBoKb dnpA== 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=YSYxBHs3htUZTTP3dGZVKSp3daWnhDhwCJCTX7nsfjc=; b=LeJpE/HdzEBiEqhQrry8T4wiFR0m4yEVaoL/OJl6nwMPP7G0AXYD2mGla3PSbOA8w2 OyabC5l9Xl2FskIaaSNmIeYKoFnD1iULJCNG+RecRc+MvS3fj/6W0KWgb6a1+249yGw0 14n8NG8WcpXh03MnLxoYq5UIV/pwfKwqBK1WJhbJBoflgOC/jBCnaB0z5s2AKgjOXtYo GaUUJ93qRYZRZ9BVKqI91cycz79ieVFAyGQ2LfGmP9f4ip5Mu0f+xv5bIw6XI/+BguUm 8tIQA/KKIRxRUoLoOeL0m0r/m+PDHKhRZv5kHo5YfynbJ4gfWYlImMSxUuqmMz9Ugrva uxkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsjnYkMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h71-20020a63834a000000b0043c87ece306si1361493pge.534.2022.09.26.06.15.21; Mon, 26 Sep 2022 06:15:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PsjnYkMo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239220AbiIZL6f (ORCPT + 99 others); Mon, 26 Sep 2022 07:58:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239343AbiIZLzQ (ORCPT ); Mon, 26 Sep 2022 07:55:16 -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 EFC265850A; Mon, 26 Sep 2022 03:50:45 -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 A4C4760C84; Mon, 26 Sep 2022 10:50:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B03F7C433C1; Mon, 26 Sep 2022 10:50:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664189445; bh=Ka5PaCCHQrmEX4KQM/pycNos7zvlpFKjn3hje8kJk5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PsjnYkMoXG3t/AQ1EaOPRhSz6IHYAvozNDV5Pxnu/pzzaHiw3gnZAX0rXAmL/Z/IU rUpVlgSbGgroJ4Kj2ctjHeXyxFBwklw61RTdQY0fMsFnMQQn8LIV2nVzr85gSq31V0 8J4piza5UpxzPvz+dY4GIMYjzHK5x5zpAJmpfFEA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Oleksij Rempel , Wolfram Sang , Sasha Levin Subject: [PATCH 5.19 190/207] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Date: Mon, 26 Sep 2022 12:12:59 +0200 Message-Id: <20220926100815.121146290@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: Uwe Kleine-König [ Upstream commit 085aacaa73163f4b8a89dec24ecb32cfacd34017 ] pm_runtime_get_sync() returning 1 also means the device is powered. So resetting the chip registers in .remove() is possible and should be done. Reported-by: Dan Carpenter Fixes: d98bdd3a5b50 ("i2c: imx: Make sure to unregister adapter on remove()") Signed-off-by: Uwe Kleine-König Acked-by: Oleksij Rempel Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-imx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index e47fa3465671..3082183bd66a 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1583,7 +1583,7 @@ static int i2c_imx_remove(struct platform_device *pdev) if (i2c_imx->dma) i2c_imx_dma_free(i2c_imx); - if (ret == 0) { + if (ret >= 0) { /* setup chip registers to defaults */ imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IADR); imx_i2c_write_reg(0, i2c_imx, IMX_I2C_IFDR); -- 2.35.1