From patchwork Wed Jun 26 00:41:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keiji Hayashibara X-Patchwork-Id: 167765 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp218892ilk; Tue, 25 Jun 2019 17:41:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzxaVweY9S0AQR3H/ph7o/RJIYvdhnFEOUvq6EK/hDbwbV16Mp+OQXYcPQtQQ8vZMx8LKYX X-Received: by 2002:a17:90a:22ef:: with SMTP id s102mr896699pjc.2.1561509719193; Tue, 25 Jun 2019 17:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561509719; cv=none; d=google.com; s=arc-20160816; b=Z+d/rwwGEyJjFWr9UhwqBN+5CASEaIkY6mb7mIFm0Rh51wDH067NpVyDuQUmVdukHf psbuwbIlnP2PSVdSpt0MspUE80OTYHxmqcII5kIrPUGtabC9mKnyjvwKiEUa7taqYqkv Gb2QMtPmqf+cvMI18WgdASS/sCPDhU7eEpuFvL1PCaxsjXM4anrqPW5ROzHHLJxDfPuZ wboS4wsRaWwgTC58HMxUf987j1T8kRqJRodsFAYLyqY/Myj4BCrNXKHHjp7AzD39XmHp YN9Z/joupcf4TakWU7pH6BrWQ9Ns3bDFjlfT9PwEvPwjjdMj7iRBKuHwDozAIMUgPRXb o36g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=gwQo4WnhpID5F3MYNXtADcAlVvZeiWtsuTwTjOsRvrw=; b=YuM7vTOgD7Um9q0R8wPg7e86r6rUgH43UtKbjXcYzH0cANAtrcXy8CrbQ5eFQTvAiS e7Iggopfd4rpKNK+viGJuiPVtGZdNhs0gQFK8/RBTV4JZjJdFjdp0v6nMckV9r11+LTl 6Gr6gQUbVpn+MEzlYiPVJoqRgD574SS3IK4o5Yq9BPdL0kVsl+1UZzYy4PuZ30aN34sx HP20+sgCFv7mK0Y68aOxae4CQxgLLTRhwuYz1x2Dtpv/Pkjgxux5hCUsj9P9FTe12UPI 3eQwQTVjytCS8+H/1EpAMwmTdZjMS8HW6zGTEwlWmXCZLWFF2WQpGLpswPjo7gDGv9nZ UEBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n10si13944888pgp.481.2019.06.25.17.41.58; Tue, 25 Jun 2019 17:41:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726464AbfFZAl5 (ORCPT + 30 others); Tue, 25 Jun 2019 20:41:57 -0400 Received: from mx.socionext.com ([202.248.49.38]:7014 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbfFZAl5 (ORCPT ); Tue, 25 Jun 2019 20:41:57 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 26 Jun 2019 09:41:55 +0900 Received: from mail.mfilter.local (m-filter-2 [10.213.24.62]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 8F16F60629; Wed, 26 Jun 2019 09:41:55 +0900 (JST) Received: from 172.31.9.53 (172.31.9.53) by m-FILTER with ESMTP; Wed, 26 Jun 2019 09:41:55 +0900 Received: from yuzu.css.socionext.com (yuzu [172.31.8.45]) by iyokan.css.socionext.com (Postfix) with ESMTP id 78EDF40377; Wed, 26 Jun 2019 09:41:55 +0900 (JST) Received: from hamster.e01.socionext.com (unknown [10.213.134.20]) by yuzu.css.socionext.com (Postfix) with ESMTP id 4E6AD120138; Wed, 26 Jun 2019 09:41:55 +0900 (JST) From: Keiji Hayashibara To: broonie@kernel.org, yamada.masahiro@socionext.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: masami.hiramatsu@linaro.org, jaswinder.singh@linaro.org, linux-kernel@vger.kernel.org, hayashibara.keiji@socionext.com Subject: [PATCH 1/2] spi: uniphier: fix timeout error Date: Wed, 26 Jun 2019 09:41:47 +0900 Message-Id: <1561509708-4175-2-git-send-email-hayashibara.keiji@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561509708-4175-1-git-send-email-hayashibara.keiji@socionext.com> References: <1561509708-4175-1-git-send-email-hayashibara.keiji@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Timeout error was silently ignored. This commit adds timeout error handling and modifies return type of wait_for_completion_timeout(). Signed-off-by: Keiji Hayashibara --- drivers/spi/spi-uniphier.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/drivers/spi/spi-uniphier.c b/drivers/spi/spi-uniphier.c index 5a6137f..c3c35c0 100644 --- a/drivers/spi/spi-uniphier.c +++ b/drivers/spi/spi-uniphier.c @@ -328,7 +328,8 @@ static int uniphier_spi_transfer_one(struct spi_master *master, struct spi_transfer *t) { struct uniphier_spi_priv *priv = spi_master_get_devdata(master); - int status; + struct device *dev = master->dev.parent; + unsigned long time_left; uniphier_spi_setup_transfer(spi, t); @@ -338,13 +339,15 @@ static int uniphier_spi_transfer_one(struct spi_master *master, uniphier_spi_irq_enable(spi, SSI_IE_RCIE | SSI_IE_RORIE); - status = wait_for_completion_timeout(&priv->xfer_done, - msecs_to_jiffies(SSI_TIMEOUT_MS)); + time_left = wait_for_completion_timeout(&priv->xfer_done, + msecs_to_jiffies(SSI_TIMEOUT_MS)); uniphier_spi_irq_disable(spi, SSI_IE_RCIE | SSI_IE_RORIE); - if (status < 0) - return status; + if (!time_left) { + dev_err(dev, "transfer timeout.\n"); + return -ETIMEDOUT; + } return priv->error; }