From patchwork Tue Aug 14 06:44:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Herrenschmidt X-Patchwork-Id: 957371 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41qNPx3cPGz9s8k for ; Tue, 14 Aug 2018 16:45:09 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41qNPx2GM4zF0bZ for ; Tue, 14 Aug 2018 16:45:09 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=permerror (mailfrom) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=benh@kernel.crashing.org; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41qNPs4cF9zF0WK for ; Tue, 14 Aug 2018 16:45:04 +1000 (AEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id w7E6ixrR020628 for ; Tue, 14 Aug 2018 01:45:00 -0500 Message-ID: <7a62778e680d8d6201d5f7b00341e7d06aa67c0d.camel@kernel.crashing.org> From: Benjamin Herrenschmidt To: skiboot@lists.ozlabs.org Date: Tue, 14 Aug 2018 16:44:59 +1000 X-Mailer: Evolution 3.28.5 (3.28.5-1.fc28) Mime-Version: 1.0 Subject: [Skiboot] [PATCH 1/2] i2c: Fix multiple-enqueue of the same request on NACK X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" i2c_request_send() will retry the request if the error is a NAK, however it forgets to clear the "ud.done" flag. It will thus loop again and try to re-enqueue the same request causing internal request list corruption. Signed-off-by: Benjamin Herrenschmidt --- core/i2c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/i2c.c b/core/i2c.c index d4311c27..070a0f6f 100644 --- a/core/i2c.c +++ b/core/i2c.c @@ -224,11 +224,10 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write, rc = ud.rc; - if (rc == OPAL_I2C_NACK_RCVD) - continue; - else - /* error or success */ + /* error or success */ + if (rc != OPAL_I2C_NACK_RCVD) break; + ud.done = false; } prlog(PR_DEBUG, "I2C: %s req op=%x offset=%x buf=%016llx buflen=%d "