From patchwork Wed Feb 15 13:01:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 57526 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp179349wrn; Wed, 15 Feb 2023 05:07:24 -0800 (PST) X-Google-Smtp-Source: AK7set/4st6rQMyvBfgK6CqYAe/V14uwaLGFy23/WdRDgcIUjS95NkjP8vddMeXU+ZP/de3Ezz0f X-Received: by 2002:a17:906:1313:b0:8aa:bf4e:7b2c with SMTP id w19-20020a170906131300b008aabf4e7b2cmr2134056ejb.21.1676466444519; Wed, 15 Feb 2023 05:07:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676466444; cv=none; d=google.com; s=arc-20160816; b=MkqbQ6saca3cvJrCbl5ypHIUp5izbvbiN7DwNNGxovwbkFBpRM0FV5bevGabUJnYhI c7qIYHTfqGKW9bA08UhFVI7CMHMUa2GlGtDJNOSJ6qt/4UJToaQSHkMa6WnNe09G0c63 P10tQD6FlMC6w8dak7Lk03hxf6yhzx97SNNr53UeZ/9yCMuFUWa0YOMy2DXLWrhVJvhT xWwNCHxbvcUkdTjN2Kplh5VwiMxVMe+xN/yoFYzZff2YR8C6Yqwbhs1h5Nub/+BMkcLf nsu1CWytZ18KDt83NJPPLC+WC/rA/6gSqCC5juGLU0GRwCdBG1cFnsuNyN+PIYAcNbCs eecg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=yYz8in3DIfhIwC+EXZRFIirdT5ng+NyfAz9Be1Kl7gA=; b=cFTMohHX7DONbJXg1BF/Pah5PUlbo7PEIoh/+ThNYdpORXh7V1iZJ0ZvZW3fQ4u2We a1O6jgKeOiYhhmK5YH5QziYh+eidg0gGGvpWpLpygJ0xeLVZMtx8xIB/s33x8/YAqhMI TbO4Vq0V/wcrXFlFz7j+Sd5rmWNBjwRJnCVFd1TU+9l2jPqt+dH19SMkFU+6W0Knl6S3 fnjQZGnJ8fGQHrWPJ8lm1KTWmmMLKyJqf6mstyhgqJEOIv3R4iRRU4xntMDyC1cnK4Za A4gaLBBM0YHphY3J8//t73ku7T2d14hNDKJrDDaLo75AUQ59Z1nhpbmXetKTUevR4yME qKLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e8-20020a170906748800b008b1450fc328si2185175ejl.914.2023.02.15.05.07.00; Wed, 15 Feb 2023 05:07:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233613AbjBONBm (ORCPT + 99 others); Wed, 15 Feb 2023 08:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbjBONBj (ORCPT ); Wed, 15 Feb 2023 08:01:39 -0500 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C7D738B47 for ; Wed, 15 Feb 2023 05:01:33 -0800 (PST) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id SHPepPq8UqIOtSHPepCxKZ; Wed, 15 Feb 2023 14:01:31 +0100 X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Wed, 15 Feb 2023 14:01:31 +0100 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Masahisa Kojima , Jassi Brar , Mark Brown , Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-spi@vger.kernel.org Subject: [PATCH] spi: synquacer: Fix timeout handling in synquacer_spi_transfer_one() Date: Wed, 15 Feb 2023 14:01:28 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757902478613494535?= X-GMAIL-MSGID: =?utf-8?q?1757902478613494535?= wait_for_completion_timeout() never returns a <0 value. It returns either on timeout or a positive value (at least 1, or number of jiffies left till timeout) So, fix the error handling path and return -ETIMEDOUT should a timeout occur. Fixes: b0823ee35cf9 ("spi: Add spi driver for Socionext SynQuacer platform") Signed-off-by: Christophe JAILLET Acked-by: Jassi Brar --- Compile tested only. --- drivers/spi/spi-synquacer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index 47cbe73137c2..dc188f9202c9 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -472,10 +472,9 @@ static int synquacer_spi_transfer_one(struct spi_master *master, read_fifo(sspi); } - if (status < 0) { - dev_err(sspi->dev, "failed to transfer. status: 0x%x\n", - status); - return status; + if (status == 0) { + dev_err(sspi->dev, "failed to transfer. Timeout.\n"); + return -ETIMEDOUT; } return 0;