From patchwork Sun Feb 4 20:29:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13544785 Received: from fgw23-7.mail.saunalahti.fi (fgw23-7.mail.saunalahti.fi [62.142.5.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B996F2556E for ; Sun, 4 Feb 2024 20:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707078695; cv=none; b=lsNeqsqYrNH6P/t0iES09alo/phMKybjBdkf3V6yRpL68LoSADggcmnaAiYvoxwdNqul+xdA8TBByZoeYgo7BEEbs2sJZjqvJLGEYK2VHslCfXgBpFS8QePbk7FTLQ/eiHwoMLGgG6zOrUfykd9EK6/AdX8HGS7dIL08HBBbirU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707078695; c=relaxed/simple; bh=MhE/DRokJGyxHoqiW1gqVDgK1hamRUWnqv9bb+Y9vPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZOQSWxNvSXqd8uQRPY7tAhpg6sTN35Bnj+1/vqSyQuY1807SjW1RxSeJL/1TrabsDDkg6YXN0crGmivOiUEnbCSqtudsi6k96GO/bdbGwHA0j+P8cjoHBc7NEYL3adJ8KR5x9wQffbfQL7NNWna2XoCWhU+LOjxwoL8u2g7C6wc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-30.elisa-laajakaista.fi [88.113.26.30]) by fgw23.mail.saunalahti.fi (Halon) with ESMTP id 6158c527-c39c-11ee-b972-005056bdfda7; Sun, 04 Feb 2024 22:31:31 +0200 (EET) From: andy.shevchenko@gmail.com To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vladimir Oltean , Minjie Du , Andy Shevchenko Subject: [PATCH v2 1/2] spi: fsl-dspi: Preserve error code returned by dmaengine_slave_config() Date: Sun, 4 Feb 2024 22:29:18 +0200 Message-ID: <20240204203127.1186621-2-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240204203127.1186621-1-andy.shevchenko@gmail.com> References: <20240204203127.1186621-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 dmaengine_slave_config() may return different error codes based on the circumstances. Preserve it instead of shadowing to -EINVAL. Suggested-by: Vladimir Oltean Signed-off-by: Andy Shevchenko Reviewed-by: Vladimir Oltean --- drivers/spi/spi-fsl-dspi.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index c9eae046f66c..0b5ea7a7da71 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -542,7 +542,6 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) ret = dmaengine_slave_config(dma->chan_rx, &cfg); if (ret) { dev_err(dev, "can't configure rx dma channel\n"); - ret = -EINVAL; goto err_slave_config; } @@ -550,7 +549,6 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) ret = dmaengine_slave_config(dma->chan_tx, &cfg); if (ret) { dev_err(dev, "can't configure tx dma channel\n"); - ret = -EINVAL; goto err_slave_config; } From patchwork Sun Feb 4 20:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13544786 Received: from fgw20-7.mail.saunalahti.fi (fgw20-7.mail.saunalahti.fi [62.142.5.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C8E325561 for ; Sun, 4 Feb 2024 20:31:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.142.5.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707078695; cv=none; b=HYndV59iKGJ/p7nec76+eP8Fz+DTwV6dIb64wRIL1098riOUFkhxM6Hlqb+FvkRzERCTiurn59Hn/7uc7dIVpiXPnRmF2svhVOmok+rE/V83+Xy4rS9EJHlxgxtceJz7BYW+H0kX9i1fId1SOnHuAS6kI7+vaF2Vv9fhQnNSy4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707078695; c=relaxed/simple; bh=XLDi5/MAVt+bIe/YQBcfp7eO7Bz7U9KmRyihYGtcmdA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iAGvLoz3avUjw6IejwzAmw0QuPhl76Z4f+XNd/lpSKsXFQBraw8qg/of8/PDm0Mahb+CzQVgZ+Yn5j2V4og19Qd+y7zBNiURe79Cj4PeOAvZXgYmfCGtlJ4Q0TPk0nn9YceYMZvbj2QysrbuDXU1L8NhcO6YMtxH4k+i+cgKTSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com; spf=fail smtp.mailfrom=gmail.com; arc=none smtp.client-ip=62.142.5.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=gmail.com Received: from localhost (88-113-26-30.elisa-laajakaista.fi [88.113.26.30]) by fgw20.mail.saunalahti.fi (Halon) with ESMTP id 61e52b80-c39c-11ee-b3cf-005056bd6ce9; Sun, 04 Feb 2024 22:31:31 +0200 (EET) From: andy.shevchenko@gmail.com To: Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vladimir Oltean , Minjie Du , Andy Shevchenko Subject: [PATCH v2 2/2] spi: fsl-dspi: Unify error messaging in dspi_request_dma() Date: Sun, 4 Feb 2024 22:29:19 +0200 Message-ID: <20240204203127.1186621-3-andy.shevchenko@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240204203127.1186621-1-andy.shevchenko@gmail.com> References: <20240204203127.1186621-1-andy.shevchenko@gmail.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use dev_err_probe() for all messages in dspi_request_dma() for the sake of making them uniform. While at it, fix indentation issue reported by Vladimir Oltean. Signed-off-by: Andy Shevchenko Reviewed-by: Vladimir Oltean --- drivers/spi/spi-fsl-dspi.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c index 0b5ea7a7da71..38defdcf9370 100644 --- a/drivers/spi/spi-fsl-dspi.c +++ b/drivers/spi/spi-fsl-dspi.c @@ -502,15 +502,12 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) return -ENOMEM; dma->chan_rx = dma_request_chan(dev, "rx"); - if (IS_ERR(dma->chan_rx)) { - return dev_err_probe(dev, PTR_ERR(dma->chan_rx), - "rx dma channel not available\n"); - } + if (IS_ERR(dma->chan_rx)) + return dev_err_probe(dev, PTR_ERR(dma->chan_rx), "rx dma channel not available\n"); dma->chan_tx = dma_request_chan(dev, "tx"); if (IS_ERR(dma->chan_tx)) { - ret = PTR_ERR(dma->chan_tx); - dev_err_probe(dev, ret, "tx dma channel not available\n"); + ret = dev_err_probe(dev, PTR_ERR(dma->chan_tx), "tx dma channel not available\n"); goto err_tx_channel; } @@ -541,14 +538,14 @@ static int dspi_request_dma(struct fsl_dspi *dspi, phys_addr_t phy_addr) cfg.direction = DMA_DEV_TO_MEM; ret = dmaengine_slave_config(dma->chan_rx, &cfg); if (ret) { - dev_err(dev, "can't configure rx dma channel\n"); + dev_err_probe(dev, ret, "can't configure rx dma channel\n"); goto err_slave_config; } cfg.direction = DMA_MEM_TO_DEV; ret = dmaengine_slave_config(dma->chan_tx, &cfg); if (ret) { - dev_err(dev, "can't configure tx dma channel\n"); + dev_err_probe(dev, ret, "can't configure tx dma channel\n"); goto err_slave_config; }