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 5959FC433F5 for ; Mon, 6 Dec 2021 15:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352059AbhLFPsD (ORCPT ); Mon, 6 Dec 2021 10:48:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56884 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386659AbhLFP0u (ORCPT ); Mon, 6 Dec 2021 10:26:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB08C061746; Mon, 6 Dec 2021 07:17:17 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 77FCEB8111A; Mon, 6 Dec 2021 15:17:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB11DC341C2; Mon, 6 Dec 2021 15:17:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1638803835; bh=IZ9RzUYU5zTNMP0ZkAXhMk8RhlGVoe3PKVPPYFaSBmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=voJVqTGT8tUKsNVaQy6bKHbUIK3zHwv7xx/9zfPvEzthfUgc2FppXkkEGKgyPSj9c J3UTnGYxY6bJz0/LapXBOSNxoqKwQPNmdgbamZVgvefHzK9ia3WC4fQmv3/weG7Z8R 8l4g1e6RANDvNqW7bOA/GD49WyPpjhE9bO/bHLH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alain Volmat , Pierre-Yves MORDRET , Wolfram Sang Subject: [PATCH 5.10 062/130] i2c: stm32f7: recover the bus on access timeout Date: Mon, 6 Dec 2021 15:56:19 +0100 Message-Id: <20211206145601.816983146@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20211206145559.607158688@linuxfoundation.org> References: <20211206145559.607158688@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: Alain Volmat commit b933d1faf8fa30d16171bcff404e39c41b2a7c84 upstream. When getting an access timeout, ensure that the bus is in a proper state prior to returning the error. Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver") Signed-off-by: Alain Volmat Reviewed-by: Pierre-Yves MORDRET Signed-off-by: Wolfram Sang Signed-off-by: Greg Kroah-Hartman --- drivers/i2c/busses/i2c-stm32f7.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/i2c/busses/i2c-stm32f7.c +++ b/drivers/i2c/busses/i2c-stm32f7.c @@ -1681,6 +1681,7 @@ static int stm32f7_i2c_xfer(struct i2c_a i2c_dev->msg->addr); if (i2c_dev->use_dma) dmaengine_terminate_all(dma->chan_using); + stm32f7_i2c_wait_free_bus(i2c_dev); ret = -ETIMEDOUT; } @@ -1738,6 +1739,7 @@ static int stm32f7_i2c_smbus_xfer(struct dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr); if (i2c_dev->use_dma) dmaengine_terminate_all(dma->chan_using); + stm32f7_i2c_wait_free_bus(i2c_dev); ret = -ETIMEDOUT; goto pm_free; }