From patchwork Fri Apr 22 06:17:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Francois Moine X-Patchwork-Id: 8906041 Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4F1E59F1D3 for ; Fri, 22 Apr 2016 06:30:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D83E20254 for ; Fri, 22 Apr 2016 06:30:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CA2420221 for ; Fri, 22 Apr 2016 06:30:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751712AbcDVGah (ORCPT ); Fri, 22 Apr 2016 02:30:37 -0400 Received: from smtp5-g21.free.fr ([212.27.42.5]:5933 "EHLO smtp5-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751681AbcDVGag (ORCPT ); Fri, 22 Apr 2016 02:30:36 -0400 Received: from localhost (unknown [IPv6:2a01:e35:2f5c:9de0:6b55:87da:4920:b782]) by smtp5-g21.free.fr (Postfix) with ESMTP id 8BD9E5FEF1; Fri, 22 Apr 2016 04:28:38 +0200 (CEST) X-Mailbox-Line: From 8fad6ddb3e59fcb9732b00b934ef24e948d05dee Mon Sep 17 00:00:00 2001 Message-Id: <8fad6ddb3e59fcb9732b00b934ef24e948d05dee.1461306176.git.moinejf@free.fr> In-Reply-To: References: From: Jean-Francois Moine Date: Fri, 22 Apr 2016 08:17:14 +0200 Subject: [PATCH RESEND v3 2/2] dmaengine: sun6i: Fix impossible settings of burst and bus width To: Vinod Koul , Maxime Ripard , Chen-Yu Tsai Cc: linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, dmaengine@vger.kernel.org Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the commit 1f9cd915b64bb95f ("dmaengine: sun6i: Fix memcpy operation"), the signed values returned by convert_burst() and convert_buswidth() were stored in an unsigned value. Then, these values were considered as errors when non null. As a result, DMA transfers were rejected when the burst or buswidth had values different from 1, as 8 for the burst or 4 for the bus width. Acked-by: Maxime Ripard Signed-off-by: Jean-Francois Moine --- drivers/dma/sun6i-dma.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/dma/sun6i-dma.c b/drivers/dma/sun6i-dma.c index 2ec320d..3579ee7 100644 --- a/drivers/dma/sun6i-dma.c +++ b/drivers/dma/sun6i-dma.c @@ -281,25 +281,25 @@ static inline int sun6i_dma_cfg_lli(struct sun6i_dma_lli *lli, dma_addr_t dst, u32 len, struct dma_slave_config *config) { - u8 src_width, dst_width, src_burst, dst_burst; + s8 src_width, dst_width, src_burst, dst_burst; if (!config) return -EINVAL; src_burst = convert_burst(config->src_maxburst); - if (src_burst) + if (src_burst < 0) return src_burst; dst_burst = convert_burst(config->dst_maxburst); - if (dst_burst) + if (dst_burst < 0) return dst_burst; src_width = convert_buswidth(config->src_addr_width); - if (src_width) + if (src_width < 0) return src_width; dst_width = convert_buswidth(config->dst_addr_width); - if (dst_width) + if (dst_width < 0) return dst_width; lli->cfg = DMA_CHAN_CFG_SRC_BURST(src_burst) |