Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp755296pxb; Tue, 5 Apr 2022 21:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvl/h2zGFXD0qbegXy7MCY51a6kdOiecfI+SjSQFEidfAv5NtkHVwmkklPnBf7WY2jIUr+ X-Received: by 2002:a17:902:a40f:b0:14b:61:b19e with SMTP id p15-20020a170902a40f00b0014b0061b19emr6964637plq.20.1649220965350; Tue, 05 Apr 2022 21:56:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649220965; cv=none; d=google.com; s=arc-20160816; b=LYje8DYhSZ5FZYZh9kgLmh08hhoDWuZckTMOcMWYV+qyo5s84x9eV5A+7kBmidWiSQ nNsdARBOGuCOcJlhAv/F1bIr1rFgb54cPXwR3E4YUiOWaqF/zc7Jro0HAwPmgkFDpn7j YZPoV948tGC9LEMGw03F+FQXHhlM4VKijgFV1HgdPZhnvqm8oFbMur7+Vlz6MzHW6FXJ YgehdglJp0MroEe4N6LGn0qO2e4QwAHHn85ANjc3tlSz0yS3i9jq3dDwv7CcIXBDxJpO egr+/pejBfYGJAjUCfP2JX2ddKm3oOAWk3Rlj4m9LAscLlyjl+91SphRiRQSY7VtCMtb K+uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=iGqNgPzBbYn/0hUaD1muBucG+A1bOm4cA8SXbFW2u/M=; b=gWrFTS7DdvqlW84UNF+PpQsNT1yyR8d1spmHTpFk3EMLJ1JKd5Zd15mmuaaCr12Fv0 Ma+wgFHLPI64ZSR0TYdFj2+0FjBw9aV9vJfhVA2mtQnf/VC6DVTLmxWG8pFMeCovnmlK WUJtIGvbs1HkkQOzEmHjCha4zuWG9CmWoIZePlzBHLbBNZskVHc0YRxhaiTE2WdRrizn MFNEobsove9ZqvLZ2sY1KVgaRbA3n6xb+YmkkuR+18O6GMN3Cjvbyph2TVcu3Bkm59E7 rMCR96DUeurQjUDIT7IxkkRA2FfzEncKL6lFRxkbkIbig7XZsgIFiFeZ0I2YO7js5P0X R6kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZoXTa3x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m130-20020a633f88000000b003986444128fsi11456166pga.671.2022.04.05.21.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 21:56:05 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fZoXTa3x; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CB430D1113; Tue, 5 Apr 2022 20:15:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380178AbiDEL6Q (ORCPT + 99 others); Tue, 5 Apr 2022 07:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245022AbiDEIxC (ORCPT ); Tue, 5 Apr 2022 04:53:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4658DAE; Tue, 5 Apr 2022 01:49:41 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 34B95CE1B55; Tue, 5 Apr 2022 08:49:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F8EBC385A1; Tue, 5 Apr 2022 08:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148578; bh=ILWExaWFs9IY44mWLEJ+w6njJpf64YYLdcomOi8/aGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fZoXTa3xhYPZQsxG0oACWf8Zv4oCt0CqWnR86uaQX0XlnbRX56KNILGFHa1FuWpYm 5Ue1suqM5FPuoKTK7TnW2ORvl9wr4lThB6Dw+fRQ1tbfPNU0vhNA0rWtI7glNuyTvB rwU1FysBTLWDz+XEsU6d55KRpSDodq+RiYmTgQk8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Melissa Wen , Melissa Wen , Sasha Levin Subject: [PATCH 5.16 0406/1017] drm/v3d/v3d_drv: Check for error num after setting mask Date: Tue, 5 Apr 2022 09:21:59 +0200 Message-Id: <20220405070406.340107174@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jiasheng Jiang [ Upstream commit 4a39156166b90465da0f9a33b3442d63b5651bec ] 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. Also, we can create a variable for the mask to solve the alignment issue. Fixes: 334dd38a3878 ("drm/v3d: Set dma_mask as well as coherent_dma_mask") Signed-off-by: Jiasheng Jiang Reviewed-by: Melissa Wen Signed-off-by: Melissa Wen Link: https://patchwork.freedesktop.org/patch/msgid/20220110013807.4105270-1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin --- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c index bd46396a1ae0..1afcd54fbbd5 100644 --- a/drivers/gpu/drm/v3d/v3d_drv.c +++ b/drivers/gpu/drm/v3d/v3d_drv.c @@ -219,6 +219,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) int ret; u32 mmu_debug; u32 ident1; + u64 mask; v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm); if (IS_ERR(v3d)) @@ -237,8 +238,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev) return ret; mmu_debug = V3D_READ(V3D_MMU_DEBUG_INFO); - dma_set_mask_and_coherent(dev, - DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH))); + mask = DMA_BIT_MASK(30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_PA_WIDTH)); + ret = dma_set_mask_and_coherent(dev, mask); + if (ret) + return ret; + v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH); ident1 = V3D_READ(V3D_HUB_IDENT1); -- 2.34.1