From patchwork Sat Jul 23 19:31:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 9244725 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1BC8C60757 for ; Sat, 23 Jul 2016 19:28:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EEE9D26538 for ; Sat, 23 Jul 2016 19:28:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D11CB27F99; Sat, 23 Jul 2016 19:28:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76C0A26538 for ; Sat, 23 Jul 2016 19:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226AbcGWT2W (ORCPT ); Sat, 23 Jul 2016 15:28:22 -0400 Received: from www.osadl.org ([62.245.132.105]:40200 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751260AbcGWT2W (ORCPT ); Sat, 23 Jul 2016 15:28:22 -0400 Received: from debian01.hofrr.at (mail.osadl.at [92.243.35.153]) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id u6NJSAdQ010338; Sat, 23 Jul 2016 21:28:11 +0200 From: Nicholas Mc Guire To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] spi: pic32: fixup wait_for_completion_timeout return handling Date: Sat, 23 Jul 2016 21:31:20 +0200 Message-Id: <1469302280-32461-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP wait_for_completion_timeout returns unsigned long not int so the check for <= 0 should be == 0 here. Signed-off-by: Nicholas Mc Guire --- API non-compliance was located by coccinelle Compile tested with: pic32mzda_defconfig + CONFIG_SPI=y, CONFIG_SPI_PIC32=m Patch is against 4.7.0-rc7 (localversion-next -next-20160719) drivers/spi/spi-pic32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c index 73db87f..fefb688 100644 --- a/drivers/spi/spi-pic32.c +++ b/drivers/spi/spi-pic32.c @@ -507,6 +507,7 @@ static int pic32_spi_one_transfer(struct spi_master *master, { struct pic32_spi *pic32s; bool dma_issued = false; + unsigned long timeout; int ret; pic32s = spi_master_get_devdata(master); @@ -553,8 +554,8 @@ static int pic32_spi_one_transfer(struct spi_master *master, } /* wait for completion */ - ret = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); - if (ret <= 0) { + timeout = wait_for_completion_timeout(&pic32s->xfer_done, 2 * HZ); + if (timeout == 0) { dev_err(&spi->dev, "wait error/timedout\n"); if (dma_issued) { dmaengine_terminate_all(master->dma_rx);