Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3653357pxb; Mon, 24 Jan 2022 14:31:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIB/FBuP/2PH8+3fwR9l6jymb28b4Ek64IluDZzMYJzHQdMps47sRaye1c4GQWHxIUGS6v X-Received: by 2002:a17:90b:1d84:: with SMTP id pf4mr454550pjb.106.1643063471415; Mon, 24 Jan 2022 14:31:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063471; cv=none; d=google.com; s=arc-20160816; b=fhEaDYGsBdzYujM9rluTrebjeoAGH2Qn3AciHgcoIXVxCrYPu/WBTvCqmXpoHKvmJw IzNCNUnqu+G9SKZ83Fo/l/MDx8HQkqJ/+QvCRxLetzTLLbNwGLfLMiD6eixhWuKnMoJs NyCSM/ecBucJY9LwaOO82AKuRyTKZbX8882xxGc740/xdCfp5OXneWjNSOIfyFtk6O4c rAn8n3t8yWD1vHbsmR7Ne1Ecgv22J7xWfSh14C6Y8OEb3zBJ7pJCbh0th3gCeBQ8KM33 mvkN0YdKYNS38QH2hOYlFB2UITnGIhhcVsK4AkfeBJUwW6uGBpw++4Df6o6TzF9RzlBD zBbQ== 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=nGFQFrVkLzKBjd/nwA+n+p/88juxFWZZHXGyBo1O7Y4=; b=GMdBzjIZXdVqTrUVoQ/EE20l7SnSsH99NcugeFWisrLGYQ2X7GXqK00v53NcnaBh8V gAGIdavdVclpuRziDlj0pNJuuEKty9YmzMU5qnjaoGKDwLFI0oLux4rKwAwllvwQ1MtM eaylXxPdZnDzNrJBzyUHJLnco0kGTUpr2Y1YZ3gc5ZyM3kzuZu2GdbYBEu2O6KE5aI76 jbuH5F1bKM2h+n+DAye+x+NDeobJVR2+Wn/VCvnBqr4lojHJ67oE6hEYiNmbYFO+MOA4 3N6JSgfeboT5oOcJz/wdH/oU0w77OucJ9dBtIYtra3lXQFN/x5wUKjO4qKDtWLUSmlRj bwNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="H8R5I3/R"; 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 l68si7432694pfl.186.2022.01.24.14.30.59; Mon, 24 Jan 2022 14:31:11 -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="H8R5I3/R"; 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 S1585956AbiAXWZZ (ORCPT + 99 others); Mon, 24 Jan 2022 17:25:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449925AbiAXV3H (ORCPT ); Mon, 24 Jan 2022 16:29:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D33BC01D7F4; Mon, 24 Jan 2022 12:19:06 -0800 (PST) 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 3D069614C9; Mon, 24 Jan 2022 20:19:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A6A9C340F0; Mon, 24 Jan 2022 20:19:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643055545; bh=iEifKO53anA59UcAXnnj8WQH6o4GLsEFVJBsKZrolJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8R5I3/RqaJbcZiwPq3RtfwvHPlVQUZD0HxRJ5a9iPererbLGL15qcYw/4uA4+tjh qdhJHQ0bxtV6pqzve8xQGvNHkl/EDreTvMShg/zWD/n+Oe2flOHXwKaocxK20Y8Ify k4J1oQ8DtkiWNkGu/8y97FjkXGJZxKY9IHkH2BCM= 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 5.15 154/846] tty: serial: atmel: Check return code of dmaengine_submit() Date: Mon, 24 Jan 2022 19:34:31 +0100 Message-Id: <20220124184106.302001620@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 249ea35088d27..16ff972decfef 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; -- 2.34.1