From patchwork Thu Aug 21 00:53:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 4755071 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E57C19F3B4 for ; Thu, 21 Aug 2014 00:53:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5AC92014A for ; Thu, 21 Aug 2014 00:53:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9DF920155 for ; Thu, 21 Aug 2014 00:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750843AbaHUAxG (ORCPT ); Wed, 20 Aug 2014 20:53:06 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:61147 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750703AbaHUAxF (ORCPT ); Wed, 20 Aug 2014 20:53:05 -0400 Received: by mail-pa0-f46.google.com with SMTP id lj1so13242125pab.19 for ; Wed, 20 Aug 2014 17:53:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:from:to:cc:in-reply-to:references:subject :user-agent:mime-version:content-type; bh=YcSCz1eQBnB8+Ekv/zJXk/2T5WBZlmaxA4e5KV9BQl4=; b=vN61baUpklcSLDFBZgWxGIbDn6cI1mu1XtRYu2vAgk+OX7igZXhYrhTKsYkMq9nGtY eAMG7YDz07E1qSGPONfBu9IeskJ76xxh940VUtSnkiC8QFi8KqR6bVn/D1prRP8uQGSC xyCoyRxo9YJaPUc9SrOmcTOed0VBUSUKD3yg/w2vbbhEVKgDZKrNWbK2ckmv8OO5kfDN 6i7GXRA2F+4H8hbt1ezt5FUkbF9i5FuDZEzOQLlyS1hc10ewKRFWg15gd04YIwy9vpXB 2fXuyySVUYk4QqbagM+Ab63GAWfZoNfmhR9ZGNwWmO+tIgdyqrY3VpXMlHGNyQGZRicg 26Rw== X-Received: by 10.70.91.167 with SMTP id cf7mr63194678pdb.3.1408582384281; Wed, 20 Aug 2014 17:53:04 -0700 (PDT) Received: from remon.gmail.com (49.14.32.202.bf.2iij.net. [202.32.14.49]) by mx.google.com with ESMTPSA id p6sm36039424pds.42.2014.08.20.17.53.02 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 20 Aug 2014 17:53:03 -0700 (PDT) Date: Wed, 20 Aug 2014 17:53:03 -0700 (PDT) Message-ID: <87d2buk6j7.wl%kuninori.morimoto.gx@gmail.com> From: Kuninori Morimoto To: Vinod Koul Cc: dmaengine@vger.kernel.org, linux-sh@vger.kernel.org, Magnus Damm , Simon Horman , Ryo Kataoka , Jun Watanabe , NAOYA SHIIBA , Koei Abe , Masahiro Fukuda , Koichi Takahashi In-Reply-To: <87egwak7ad.wl%kuninori.morimoto.gx@renesas.com> References: <3de5e5699d264af0a5f1fa414edcda3e@SIXPR06MB064.apcprd06.prod.outlook.com> <87y4ujh7px.wl%kuninori.morimoto.gx@renesas.com> <73f0c1453ce7466c811470df8f76466f@SIXPR06MB045.apcprd06.prod.outlook.com> <87egwak7ad.wl%kuninori.morimoto.gx@renesas.com> Subject: [PATCH] dma: rcar-audmapp: Fix for no corresponding slave ID User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Ryo Kataoka In case of no corresponding slave ID, the audmapp_set_slave() returns -ENXIO same as sh_dmae_set_slave() of shdmac.c. DMAEngine might return wrong channel without this patch Signed-off-by: Ryo Kataoka Signed-off-by: Jun Watanabe , Signed-off-by: Kuninori Morimoto --- drivers/dma/sh/rcar-audmapp.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/dma/sh/rcar-audmapp.c b/drivers/dma/sh/rcar-audmapp.c index dabbf0a..80fd2ae 100644 --- a/drivers/dma/sh/rcar-audmapp.c +++ b/drivers/dma/sh/rcar-audmapp.c @@ -117,7 +117,7 @@ static void audmapp_start_xfer(struct shdma_chan *schan, audmapp_write(auchan, chcr, PDMACHCR); } -static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id, +static int audmapp_get_config(struct audmapp_chan *auchan, int slave_id, u32 *chcr, dma_addr_t *dst) { struct audmapp_device *audev = to_dev(auchan); @@ -131,20 +131,22 @@ static void audmapp_get_config(struct audmapp_chan *auchan, int slave_id, if (!pdata) { /* DT */ *chcr = ((u32)slave_id) << 16; auchan->shdma_chan.slave_id = (slave_id) >> 8; - return; + return 0; } /* non-DT */ if (slave_id >= AUDMAPP_SLAVE_NUMBER) - return; + return -ENXIO; for (i = 0, cfg = pdata->slave; i < pdata->slave_num; i++, cfg++) if (cfg->slave_id == slave_id) { *chcr = cfg->chcr; *dst = cfg->dst; - break; + return 0; } + + return -ENXIO; } static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, @@ -153,8 +155,11 @@ static int audmapp_set_slave(struct shdma_chan *schan, int slave_id, struct audmapp_chan *auchan = to_chan(schan); u32 chcr; dma_addr_t dst; + int ret; - audmapp_get_config(auchan, slave_id, &chcr, &dst); + ret = audmapp_get_config(auchan, slave_id, &chcr, &dst); + if (ret < 0) + return ret; if (try) return 0;