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 5AE61C433F5 for ; Mon, 14 Feb 2022 11:46:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352752AbiBNLqb (ORCPT ); Mon, 14 Feb 2022 06:46:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:46310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353113AbiBNLp5 (ORCPT ); Mon, 14 Feb 2022 06:45:57 -0500 Received: from theia.8bytes.org (8bytes.org [IPv6:2a01:238:4383:600:38bc:a715:4b6d:a889]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4D4BC33 for ; Mon, 14 Feb 2022 03:43:59 -0800 (PST) Received: by theia.8bytes.org (Postfix, from userid 1000) id 8F76A36D; Mon, 14 Feb 2022 12:43:58 +0100 (CET) Date: Mon, 14 Feb 2022 12:43:57 +0100 From: Joerg Roedel To: Jiasheng Jiang Cc: will@kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Robin Murphy , Nikita Yushchenko , Laurent Pinchart Subject: Re: [PATCH] iommu/ipmmu-vmsa: Check for error num after setting mask Message-ID: References: <20220106024302.2574180-1-jiasheng@iscas.ac.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220106024302.2574180-1-jiasheng@iscas.ac.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding more potential reviewers. On Thu, Jan 06, 2022 at 10:43:02AM +0800, Jiasheng Jiang wrote: > 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: 1c894225bf5b ("iommu/ipmmu-vmsa: IPMMU device is 40-bit bus master") > Signed-off-by: Jiasheng Jiang > --- > drivers/iommu/ipmmu-vmsa.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > index aaa6a4d59057..7df5da44a004 100644 > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -1003,7 +1003,9 @@ static int ipmmu_probe(struct platform_device *pdev) > bitmap_zero(mmu->ctx, IPMMU_CTX_MAX); > mmu->features = of_device_get_match_data(&pdev->dev); > memset(mmu->utlb_ctx, IPMMU_CTX_INVALID, mmu->features->num_utlbs); > - dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); > + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); > + if (ret) > + return ret; > > /* Map I/O memory and request IRQ. */ > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > -- > 2.25.1