From patchwork Mon Jan 30 12:06:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 13121522 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 413D2C54EAA for ; Mon, 30 Jan 2023 17:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S2Ko3D5uJ2Kk0NeRd2Fh8/UNupgb3noNFI+5+BL2YBQ=; b=hVmWr5WAsujm0g Fw15yFIRcNUIp+c7+tXqQEPs+oVWCBN4hflwdYLBZxnRGbJmcCJgH5aMWmw2UH4oV67i3KcBLehWZ hWa2UppJVt+1K9wRJhy3B2G/GYX0KTJWSD+5PlVhNacWE5rgHw+ov9KimBs7mY3mE7nh5JSNqa8n/ 0mEpJbxCj5qe/XOzFTCf9bSO1p6VosnUJNUmlBZXVxSEzQn5jap39SwfNUSxFFP4TGb30YlqLTCVG pSXMNppbkG93IFaZihWKznSONRWyG/MtbwMe68AZazmx9o8J70HSBWVMdkKg7I2NjyBOuCTDHn8kQ itrqH346DFOY1eEFlLdg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMYFt-004hJd-Ly; Mon, 30 Jan 2023 17:47:46 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pMYDT-004gLS-6M for linux-arm-kernel@lists.infradead.org; Mon, 30 Jan 2023 17:45:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675100715; x=1706636715; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rU46NQL4hbbHQR9L/65OOymuaCyWdxogbhBIy2BOVDA=; b=G3KNoUt6LSgc0ay0NEO5YtNIeW8w36+d0UHqZtzjnHpCqjc+YFh4vAwZ weuVVFifUmPqXdLQNHLL8DMwo1ewkNXSIe7ur1hyzqAHR/s1RoNruLp25 ZXIipDL/pP7sL1O54bpLrKq/SbIG86A/TK0xx3VPsBLG1UxBwaAbZRp+C iXwlZQdxqTsTmN+HgVo0pwu9EuIW99mTJneEyE7EFh27xCLWUb+Ob0bMN fhvuJdwVRHssyNPy+iXyb1Ag+GbIqNpLFnxfsO49LoZiSN12FDUGHGYOP niW7cDQbu/EXu+ceeyOQlRnzYf7pAf+fkBw2+a+WUiKEoHxe5P1BB0qoO w==; X-IronPort-AV: E=Sophos;i="5.97,257,1669100400"; d="scan'208";a="197975239" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 30 Jan 2023 05:07:28 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 30 Jan 2023 05:07:28 -0700 Received: from m18063-ThinkPad-T460p.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Mon, 30 Jan 2023 05:07:24 -0700 From: Claudiu Beznea To: , , , , , CC: , , , Claudiu Beznea Subject: [PATCH 2/8] ASoC: mchp-spdifrx: fix return value in case completion times out Date: Mon, 30 Jan 2023 14:06:41 +0200 Message-ID: <20230130120647.638049-3-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130120647.638049-1-claudiu.beznea@microchip.com> References: <20230130120647.638049-1-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230130_094515_308201_222AEEE1 X-CRM114-Status: GOOD ( 11.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org wait_for_completion_interruptible_timeout() returns 0 in case of timeout. Check this into account when returning from function. Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea --- sound/soc/atmel/mchp-spdifrx.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c index 2d86e0ec930f..7f359371b31b 100644 --- a/sound/soc/atmel/mchp-spdifrx.c +++ b/sound/soc/atmel/mchp-spdifrx.c @@ -524,9 +524,10 @@ static int mchp_spdifrx_cs_get(struct mchp_spdifrx_dev *dev, ret = wait_for_completion_interruptible_timeout(&ch_stat->done, msecs_to_jiffies(100)); /* IP might not be started or valid stream might not be present */ - if (ret < 0) { + if (ret <= 0) { dev_dbg(dev->dev, "channel status for channel %d timeout\n", channel); + return ret ? : -ETIMEDOUT; } memcpy(uvalue->value.iec958.status, ch_stat->data, @@ -580,7 +581,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdifrx_dev *dev, dev_dbg(dev->dev, "user data for channel %d timeout\n", channel); mchp_spdifrx_isr_blockend_dis(dev); - return ret; + return ret ? : -ETIMEDOUT; } spin_lock_irqsave(&user_data->lock, flags);