From nobody Fri Dec 19 17:34:02 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B5D3C32771 for ; Mon, 26 Sep 2022 11:31:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234756AbiIZLbB (ORCPT ); Mon, 26 Sep 2022 07:31:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233898AbiIZLac (ORCPT ); Mon, 26 Sep 2022 07:30:32 -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 869C66B8CE; Mon, 26 Sep 2022 03:41:54 -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 4420C60769; Mon, 26 Sep 2022 10:40:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53FFEC433C1; Mon, 26 Sep 2022 10:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188831; bh=Vy9KnVHyGacXGwt7HedxWHJmgGZFE2wYut1J6ZVUkao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2INEzreL6loplwRdn+jAGfbeNE2yJVBHypCkUY/v1SkCFaXF5s18tixZGEXcFJaVq JHlHIEUySdIQL6+XSHAB9Lxv+JJU2IcLMOQezJmtJtESmddXMYPOfYg+d6nQbjNNWk JetaM7iw9ogbPvjJqRiqEKtj1n0SVMrQYyG2+sag= 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.15 136/148] i2c: imx: If pm_runtime_get_sync() returned 1 device access is possible Date: Mon, 26 Sep 2022 12:12:50 +0200 Message-Id: <20220926100801.316627384@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100756.074519146@linuxfoundation.org> References: <20220926100756.074519146@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ 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=C3=B6nig 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 3f40995c0ca9..2e4d05040e50 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -1496,7 +1496,7 @@ static int i2c_imx_remove(struct platform_device *pde= v) if (i2c_imx->dma) i2c_imx_dma_free(i2c_imx); =20 - if (ret =3D=3D 0) { + if (ret >=3D 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); --=20 2.35.1