Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4870992rwb; Tue, 8 Aug 2023 15:37:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF7WznIr6XijlOZlp4YAsNZXpbiKQ3GgXbYTnwcZlmgso81RGbFYqNJOJkvlEwrhnQcCHO8 X-Received: by 2002:a05:6a20:3d20:b0:13e:f5b5:48f5 with SMTP id y32-20020a056a203d2000b0013ef5b548f5mr954723pzi.27.1691534248698; Tue, 08 Aug 2023 15:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691534248; cv=none; d=google.com; s=arc-20160816; b=vYqPwpAK68jEs0mEKkxG7yhkojyNmMsdjjnjocjGme/pnPKitvNfrT04WCdugnfgTI JqntOsQmO2M9zjhbxgECWjs6kZhrAUfJcqQoaS6PUTtb+XJBVL+s0+Nq/vs94iLBSSKR QoXSK6DowS3uTeHfGJr65BS/MoCTPp1l+gy6zu5gws/8jYR3fupeHuJmN8wpVlEL8Fo/ GkwjQ107+0k2fJGMEw3j2cSapvqqwnemcaTij/6f4mdXqdUa4BmRnUa1YOCgxcbRsRt/ VH7SfJq2TecofYIoxniyYXKjv/qXntd7p0Yq4vskXRSKclPq9Z/afL2EJOh7PpzRNW6G /T6Q== 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 :message-id:date:subject:cc:to:from; bh=zJfoaHA5waBrRiEEFIugdd4DZBL2WXGjxAgYwe8o1EE=; fh=nfFcfPEVHLrkFMua8t6HCKoMU6122tpyeqCjKydMDMc=; b=CEWi6gHviVZKrX/tLqYQ8s6iYAwNtmSNgluM/qU5LrUW+ON3oFxMoPa3PMS5obsOIS wHOWzunpd8WQjKGVUhNterIrHuYHlvB+IybXdR7pQalRRiopNcBNRKQJfIC/V4ze9tdI dJu5Gw8AmtEz1lbfFXemWUsXpjSZiJZw0nI/y1B++MPeilX9JWKUGCRODzBFxFF2uqkG BFaZsh8X0idJFM84kIZ2oSvefx775XSsoWR9OKG6IDQ/NnKSsKo7tt5hFxbBOAkufySy xYTOzy+LGe6/QCJCOXYBzv2WccEKOzNX1cTTi2EpMitBkDmUkp2njw6/7FjOogqOQ9dT yWMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e9-20020a170902744900b001b8b4ed422bsi7903256plt.308.2023.08.08.15.37.16; Tue, 08 Aug 2023 15:37:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233833AbjHHTyO (ORCPT + 99 others); Tue, 8 Aug 2023 15:54:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjHHTx4 (ORCPT ); Tue, 8 Aug 2023 15:53:56 -0400 Received: from exchange.fintech.ru (exchange.fintech.ru [195.54.195.159]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A746F1BAE9 for ; Tue, 8 Aug 2023 11:04:23 -0700 (PDT) Received: from Ex16-01.fintech.ru (10.0.10.18) by exchange.fintech.ru (195.54.195.169) with Microsoft SMTP Server (TLS) id 14.3.498.0; Tue, 8 Aug 2023 21:04:22 +0300 Received: from localhost (10.0.253.138) by Ex16-01.fintech.ru (10.0.10.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Tue, 8 Aug 2023 21:04:21 +0300 From: Nikita Zhandarovich To: Alex Deucher , "Pan, Xinhui" CC: Nikita Zhandarovich , David Airlie , Daniel Vetter , Dave Airlie , , , , Subject: [PATCH] drm/radeon: check return value of radeon_ring_lock() Date: Tue, 8 Aug 2023 11:04:16 -0700 Message-ID: <20230808180416.7567-1-n.zhandarovich@fintech.ru> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.0.253.138] X-ClientProxiedBy: Ex16-02.fintech.ru (10.0.10.19) To Ex16-01.fintech.ru (10.0.10.18) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 In the unlikely event of radeon_ring_lock() failing, its errno return value should be processed. This patch checks said return value and prints a debug message in case of an error. Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE. Fixes: 48c0c902e2e6 ("drm/radeon/kms: add support for CP setup on SI") Signed-off-by: Nikita Zhandarovich --- drivers/gpu/drm/radeon/si.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index 8d5e4b25609d..df1b2ebc37c2 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c @@ -3611,6 +3611,10 @@ static int si_cp_start(struct radeon_device *rdev) for (i = RADEON_RING_TYPE_GFX_INDEX; i <= CAYMAN_RING_TYPE_CP2_INDEX; ++i) { ring = &rdev->ring[i]; r = radeon_ring_lock(rdev, ring, 2); + if (r) { + DRM_ERROR("radeon: cp failed to lock ring (%d).\n", r); + return r; + } /* clear the compute context state */ radeon_ring_write(ring, PACKET3_COMPUTE(PACKET3_CLEAR_STATE, 0)); -- 2.25.1