From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C0FF5847A for ; Wed, 1 Mar 2023 18:08:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45F75C433D2; Wed, 1 Mar 2023 18:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1677694085; bh=sMrq0l/y9wqy08plbjVuTZjn9BZqJcB2snofLgjf9QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BcLa0ebyEgKMpFvpVmswgGwd+O2d9S35zFlioKu/9CEYr/HiqY1+Dzl/BalvHxk0l A4qLi4np5vLJv+L2cZ0LvRzcJlNvfJQoYnAAMKtjEVEf301RE0LtGERqRQwbf0I66L 9yLmGbD01F4s36Nu13x7XdyoqkIMX/LiQ9GruFzs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Geert Uytterhoeven , Jiasheng Jiang , Vinod Koul , "Nobuhiro Iwamatsu (CIP)" Subject: [PATCH 5.4 11/13] dmaengine: sh: rcar-dmac: Check for error num after dma_set_max_seg_size Date: Wed, 1 Mar 2023 19:07:34 +0100 Message-Id: <20230301180651.610217159@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230301180651.177668495@linuxfoundation.org> References: <20230301180651.177668495@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jiasheng Jiang commit da2ad87fba0891576aadda9161b8505fde81a84d upstream. As the possible failure of the dma_set_max_seg_size(), it should be better to check the return value of the dma_set_max_seg_size(). Fixes: 97d49c59e219 ("dmaengine: rcar-dmac: set scatter/gather max segment size") Reported-by: Geert Uytterhoeven Signed-off-by: Jiasheng Jiang Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20220111011239.452837-1-jiasheng@iscas.ac.cn Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Signed-off-by: Nobuhiro Iwamatsu (CIP) --- drivers/dma/sh/rcar-dmac.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1824,7 +1824,10 @@ static int rcar_dmac_probe(struct platfo dmac->dev = &pdev->dev; platform_set_drvdata(pdev, dmac); dmac->dev->dma_parms = &dmac->parms; - dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); + ret = dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); + if (ret) + return ret; + ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); if (ret) return ret;