Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3558829pxb; Mon, 24 Jan 2022 12:11:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQhR4Kt2UyNs0+T7BnVq5GzB9JWXYV4TUsjk7B/xvOvYAsb4RsiCpvP1qXIziEVBPrpsrb X-Received: by 2002:a17:90a:9291:: with SMTP id n17mr3438635pjo.187.1643055116642; Mon, 24 Jan 2022 12:11:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055116; cv=none; d=google.com; s=arc-20160816; b=H7l83JR9l+MTcKBc2OHd/ZeLJcrhsvEVclEEiIVbZ3yQyVxpPoALm55U1WZTWsErk9 DyreVsKjkEfAGzDjSfw/kVcfLEqCjnB8CECzDLFtYvEKIs0qFMe1gL5OHDhWK78ujus/ iDmTYW62MUXWG/waSG03zwA/9ETY23PhxgBrbrRLbWbb2OS6vso65C7h8v02CQ1qQMPr 5Kvm3q8ujTBGudO22FjUzE9zndal2lLO/AmeHXGhjBF2fo9P1J6JWfnxeTXyrLIHOQYJ TjzgiCu+xpal/OQ/h91qLoZU0XEqvBDal8+62gr7aiDMzqywd4o5Lp61XFjkJKg27nHY +QBg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UYSDJ2yYxNkaiC0AC2YJaRDE26NkafdDCgrRlNHUVd4=; b=SqKMlh1BQfX8+4OtY1Vn9KkOBpvfc6M5VS29XTDuNM43xpQGeopfk/iRr5trT6cZlZ AWP9hN8rKVlr1ioorWeBWSd4pVSrAOQqcHF44Osir4hPMKzFCjTMnLKaRKNCqj4cWUiE T+xACu5kn5nDYqtOY1EPIp8fUtauUf9Fdt48F79lDQTGy/K8C+Hya7wcVdwDqwjTSuGY DQ/MydCJptCA9YwpLBA/WZt5op+35Hhgf9RfJgp63sOGosmPuKJUfEluLfZfMaOKe2o8 RWn9lbz0s98089Tbd9MzFaUATHKl9Q1HHmSKRb/R5fAw2n2wAEZ217uKX2Dnn6U24n+S I+OA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V4rSC2OL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q144si6022262pgq.59.2022.01.24.12.11.43; Mon, 24 Jan 2022 12:11:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V4rSC2OL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348132AbiAXTOz (ORCPT + 99 others); Mon, 24 Jan 2022 14:14:55 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:34170 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345535AbiAXTGB (ORCPT ); Mon, 24 Jan 2022 14:06:01 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 871F3611A9; Mon, 24 Jan 2022 19:05:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF4EC340E7; Mon, 24 Jan 2022 19:05:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051159; bh=NwEJ0PB5cZ2ip0qOlfnhIKiVZi9O8XhUde8Vry+zIXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4rSC2OL2frE5tzL5YPErYSUA58U28wXKe1rKPYXzJHT/CXK7EgUIQGo603Uws74u jpPv3EJuuueH00s0NPuIm55UG6Xy3Zxpe5VEYoYuD9nvWVvjUWvXxC9w6FtNcqkTFQ MdFAws5gMpkULkrmSeg0x/SbjLi3eyfqtbOQQSxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tudor Ambarus , Richard Genoud , Sasha Levin Subject: [PATCH 4.14 041/186] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 24 Jan 2022 19:41:56 +0100 Message-Id: <20220124183938.446310620@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tudor Ambarus [ Upstream commit 1e67bd2b8cb90b66e89562598e9c2046246832d3 ] 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 Link: https://lore.kernel.org/r/20211125090028.786832-3-tudor.ambarus@microchip.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 a00227d312d3f..9a56b88df95f8 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c @@ -925,6 +925,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) @@ -1183,6 +1188,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; -- 2.34.1