From mboxrd@z Thu Jan 1 00:00:00 1970 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 29C70C77B75 for ; Tue, 18 Apr 2023 12:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231517AbjDRMbX (ORCPT ); Tue, 18 Apr 2023 08:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231643AbjDRMbJ (ORCPT ); Tue, 18 Apr 2023 08:31:09 -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 985E310262 for ; Tue, 18 Apr 2023 05:30:51 -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 692DA631DB for ; Tue, 18 Apr 2023 12:30:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C8A5C433D2; Tue, 18 Apr 2023 12:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681821050; bh=UARv0zW1xUXNLD/z5xqu0p+oRoDRCvX+Obz/DZzjhqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FXIH5931XUw2Ra7Bgf4hkzmn7wSFZhV6lDxMDHJvzHtDTeZ1jrYriDgcIY73NJu2y w+d8Cg3nmLUpp6xJ+lnwk9oUSoZ7lmtIEt9hLUXfI4gXCoByrbYoT12HeEIxJkpjsZ BK6rpW/lYrg7pmj7b2vYANPMuXrBtl9V+WfP+YEg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexander Stein , Emanuele Ghidoli , Wolfram Sang , Sasha Levin Subject: [PATCH 5.4 65/92] i2c: imx-lpi2c: clean rx/tx buffers upon new message Date: Tue, 18 Apr 2023 14:21:40 +0200 Message-Id: <20230418120307.103507542@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418120304.658273364@linuxfoundation.org> References: <20230418120304.658273364@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Alexander Stein [ Upstream commit 987dd36c0141f6ab9f0fbf14d6b2ec3342dedb2f ] When start sending a new message clear the Rx & Tx buffer pointers in order to avoid using stale pointers. Signed-off-by: Alexander Stein Tested-by: Emanuele Ghidoli Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/busses/i2c-imx-lpi2c.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c index 13c17afe7102e..4fac2591b6618 100644 --- a/drivers/i2c/busses/i2c-imx-lpi2c.c +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c @@ -468,6 +468,8 @@ static int lpi2c_imx_xfer(struct i2c_adapter *adapter, if (num == 1 && msgs[0].len == 0) goto stop; + lpi2c_imx->rx_buf = NULL; + lpi2c_imx->tx_buf = NULL; lpi2c_imx->delivered = 0; lpi2c_imx->msglen = msgs[i].len; init_completion(&lpi2c_imx->complete); -- 2.39.2