From patchwork Mon Nov 15 14:30:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12692584 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 908D3C433F5 for ; Mon, 15 Nov 2021 14:31:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 63006610CA for ; Mon, 15 Nov 2021 14:31:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 63006610CA Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=hEnQ+8PuGrTnCWNn1hg5mSO1If6hbuARvbruUUr/hCw=; b=gaK16T7XGT6OAJ aNUqpstXNMLpThV6kD5bHgVFJxE7m3UXtvNa1SP61s+ptIHTmkqIf8jmFRTSeWvAE0KMjpOFgGqeY viwlHz8gQUb8YQJPHpmq6Xze4Shma91AfeAoJKmkinbMb3hiAgWpYBWXFsvIXrR8DrPipkauyMdVN ANr8gxDOLExALqXiq+20NC1pmzAGBNA3ZW3/cORVSPh6RO4PEb2uVDp7qgsFYC58HPXQ0EmIpy4uz VLBArAAgTQiQZDfxhj65dd7J6klTFsAZXuzC7SN0zuptgclQoApFBfvLGMIYWWic9QBytmBpD/ujB xq5hzU7W7rQjbBOCLC9A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmd04-00Frxq-DF; Mon, 15 Nov 2021 14:30:24 +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 1mmczw-00Frx1-KV for linux-arm-kernel@lists.infradead.org; Mon, 15 Nov 2021 14:30:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1636986616; x=1668522616; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zuThhgTn4F0rTfrp7sz4M3WkIvUF2eQwlt70tY+m8ik=; b=pdzpesCkpn26EPcGLI2WhSIPunrdm8uquNx9SVMPaSsSTEPUmr4fB6RL iSfSp6tWh847IAzbaHVcKYe2GBcdM1X6RLsATYAHj8FW3UriJdRYqv9eW Z51i3qgsQPcMo3EJGLAbrImIngbyf+WflZRn/apgGdwsoUKfYVOD5QEIV 1uR8ygq7oUeApzJZNhyGYh/eBRJtprnvVfQt2wiJ6sO32j7/+sSYYngE/ +ERfDvyVYWLLyWi9tgj/gN5erIvW2BxRMyAAXz4SdP9GY+1jj1ldh7En8 4ptN7vPNb87CvUA9l25F4G+nu71YtG3wjtn8+qKZ+HjpHbuGEGgqIt63Q A==; IronPort-SDR: RyZmDDRmWa63cpRskOdKhXT6QNg9JXpkCeybnqhcNSJlPwi3m5W6rqXtVsx4Pfc4YvvXfJbzS+ 4L6sTsHrOzEAvikVuAcQX4+VeheuogrPYRai4I48MxHCHF27MjfzwjUw1p5Byz1D/Bk03p4X3K Y1TBS1WS6P4ow47Hik/bXbiripHKEYVmg2wCW1Bi13fRthee2jZ/inia7UIXSZSBcSO81kPRXg 1Vi3lSQ/G9uIbIx+RHx3m3lB+wRbY8cVAhjlKNYqQg+GjZPNM+25SRMb/f3BIUyBnVwaa66Lxw mlKrmCPAxde2b23yg8pJBL3h X-IronPort-AV: E=Sophos;i="5.87,236,1631602800"; d="scan'208";a="76457711" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 15 Nov 2021 07:30:13 -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.2176.14; Mon, 15 Nov 2021 07:30:13 -0700 Received: from ROB-ULT-M18064N.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.2176.14 via Frontend Transport; Mon, 15 Nov 2021 07:30:10 -0700 From: Tudor Ambarus To: , , Subject: [PATCH] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 15 Nov 2021 16:30:04 +0200 Message-ID: <20211115143004.32743-1-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211115_063016_799699_165AFC7C X-CRM114-Status: UNSURE ( 8.67 ) X-CRM114-Notice: Please train this message. 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: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org dma_cookie_t < 0 indicates an error code, check for it. Signed-off-by: Tudor Ambarus --- drivers/tty/serial/atmel_serial.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c index 2c99a47a2535..376f7a9c2868 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -1004,6 +1004,11 @@ static void atmel_tx_dma(struct uart_port *port) desc->callback = atmel_complete_tx_dma; desc->callback_param = atmel_port; atmel_port->cookie_tx = dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_tx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_tx); + return; + } } if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) @@ -1258,6 +1263,11 @@ static int atmel_prepare_rx_dma(struct uart_port *port) desc->callback_param = port; atmel_port->desc_rx = desc; atmel_port->cookie_rx = dmaengine_submit(desc); + if (dma_submit_error(atmel_port->cookie_rx)) { + dev_err(port->dev, "dma_submit_error %d\n", + atmel_port->cookie_rx); + goto chan_err; + } return 0;