From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA3C1C4167D for ; Mon, 21 Feb 2022 09:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349132AbiBUJMF (ORCPT ); Mon, 21 Feb 2022 04:12:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347743AbiBUJHn (ORCPT ); Mon, 21 Feb 2022 04:07:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E527924591; Mon, 21 Feb 2022 01:00:10 -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 C74C861132; Mon, 21 Feb 2022 09:00:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA503C340E9; Mon, 21 Feb 2022 09:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434010; bh=bJ4V2Ngq7iuxbnHxgEVz9C+hREZ7+XAYQ/q0J3XR8k4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5yLTQHBOLU6WTvmiM5o20kqCJ5VKQ0AFrRN2pFoISIUTWz5tiwqq2fd0+EbCe2w7 hV7VXEpWv7cwpqRRmHc8/y7oUHeS/e3ECrG/U0x1SJIsbuk8hci+Nqc2Kb0HbGJh9q nUoHukthPfYi22kuW/NhnCi0HdeTUCtSyYj8VJtU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Geert Uytterhoeven , Vinod Koul Subject: [PATCH 5.4 62/80] dmaengine: sh: rcar-dmac: Check for error num after setting mask Date: Mon, 21 Feb 2022 09:49:42 +0100 Message-Id: <20220221084917.619681415@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084915.554151737@linuxfoundation.org> References: <20220221084915.554151737@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: Jiasheng Jiang commit 2d21543efe332cd8c8f212fb7d365bc8b0690bfa upstream. Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails. Fixes: dc312349e875 ("dmaengine: rcar-dmac: Widen DMA mask to 40 bits") Signed-off-by: Jiasheng Jiang Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20220106030939.2644320-1-jiasheng@iscas.ac.cn Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/sh/rcar-dmac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/dma/sh/rcar-dmac.c +++ b/drivers/dma/sh/rcar-dmac.c @@ -1825,7 +1825,9 @@ static int rcar_dmac_probe(struct platfo platform_set_drvdata(pdev, dmac); dmac->dev->dma_parms = &dmac->parms; dma_set_max_seg_size(dmac->dev, RCAR_DMATCR_MASK); - dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); + ret = dma_set_mask_and_coherent(dmac->dev, DMA_BIT_MASK(40)); + if (ret) + return ret; ret = rcar_dmac_parse_of(&pdev->dev, dmac); if (ret < 0)