From patchwork Tue Nov 16 11:20:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12692739 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 1307FC433EF for ; Tue, 16 Nov 2021 11:23:37 +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 D5DF161994 for ; Tue, 16 Nov 2021 11:23:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D5DF161994 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:References:In-Reply-To: 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: List-Owner; bh=UXEQ0KOy/p7VvC5If39xpx7Hhe7dbtVbRuD8lwNumnE=; b=q17rYTN98dvmmR Vtmdg+XbC4niUnynDNlzWBLJDSILdJPbLNZ/+l9F6RU/umbqX3c0Lb2JuG9+wNExqDmq021b1T8wp dx/Ddr0GFB0ytxDAwgU6HWdx+Jd0HGmGb7jx0GfUqY2tFRYOESlb1Kk+JB0U24fTM1rrkay/gJfcZ 8bjt3GC4Fe0WpVGyMiB8SfeXdQpxGQxWZ/RTqLKfkxk6J4lXZ4h5UkmdTd0vOR4tHBGgBwIi/Ub9D HffBeM8cLawV9zHrNnleTCp6jYVQjPB7RBP/cO0JMhzx5v9tfoL4JwJvik/3kYfo+hlchIh+OiA9Z Qfewu7OipJUrN/3/xt0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmwXK-001OLx-Mv; Tue, 16 Nov 2021 11:22:03 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mmwWA-001O0o-Oa for linux-arm-kernel@lists.infradead.org; Tue, 16 Nov 2021 11:20:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1637061650; x=1668597650; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xaQDP9vrd8gtsEUZVxgHa5VLGiEX80T1mW9+VkOCiK8=; b=U9Y7DVPDjlKvxJqRAyIQDoXUA9Cu3RKvbKiTgCFkTrJfi7troTlsdO5F J0h4y+okOboKbHf6zkppt6nWhbmCDyPz7clZ2uNpnYEt5dRwXlXz+XqoG vtadYv6Y0TAvf6/u4ht2rVdg5UfOjbsixZGxV0svcaupXtzdBWbTxyjV8 4O7KxkbJa23usE+qzNLliHlSvv9BkIWoRrfPav8aSoTjPRD2jXpNZ9SUB UF2s4dtakRKCJKGLZNjBIyWlUCQ+vhYbWagl0CbD1Fsti+F4hqWyNIpel gs0Mw7RA6PebS6Vts7poWwjyS+5CKlzEW1ryOwFWhwlzjd1edlfrBvDar w==; IronPort-SDR: AvLCpxdZ63WH8CN4xCAxbx9yjhF1PyUe6YemaWAxEi2Bq0ujWbW0gnjoK3O5S/HGcasdKvx77x apeh4dceBqeE27QgAp4ltVu6mvwjebZ2TfAogXZhAffZqzosAm6gVXAbE8QpZJHTCeUeWMRSWt 4VlBy64kDKrmiYVA6S56pjFSXqe8fxKCYGmSq+MUGZoOfMhnrozulvJdFMdVsBdhm6RH0CN8wr MlwiI0ah5GBDhcNo+p8swaPXQ8dr3ba3xnSs/PuPsmM92ww4NES2Pp/nVuk3TgTHL399mbjHYK OuyLDwj/SyxkZs9MOQ7p1gOP X-IronPort-AV: E=Sophos;i="5.87,239,1631602800"; d="scan'208";a="144082826" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 16 Nov 2021 04:20:49 -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; Tue, 16 Nov 2021 04:20:49 -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; Tue, 16 Nov 2021 04:20:45 -0700 From: Tudor Ambarus To: , , , , Subject: [PATCH 02/13] tty: serial: atmel: Check return code of dmaengine_submit() Date: Tue, 16 Nov 2021 13:20:25 +0200 Message-ID: <20211116112036.96349-3-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211116112036.96349-1-tudor.ambarus@microchip.com> References: <20211116112036.96349-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211116_032050_863474_A30F8239 X-CRM114-Status: UNSURE ( 9.94 ) 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 , mripard@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, dmaengine@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 The tx_submit() method of struct dma_async_tx_descriptor is entitled to do sanity checks and return errors if encountered. It's not the case for the DMA controller drivers that this client is using (at_h/xdmac), because they currently don't do sanity checks and always return a positive cookie at tx_submit() method. In case the controller drivers will implement sanity checks and return errors, print a message so that the client will be informed that something went wrong at tx_submit() level. Fixes: 08f738be88bb ("serial: at91: add tx dma support") Signed-off-by: Tudor Ambarus Acked-by: Richard Genoud --- 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;