Message ID | 20230808180416.7567-1-n.zhandarovich@fintech.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp2380106vqr; Tue, 8 Aug 2023 13:34:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEGqnzcgY3oi5lOQle1Sgny+up+Egy6H1uEzVBLBF6mgniJebLf5aiHf/p+L3fuMik40Fa+ X-Received: by 2002:a17:902:d4c4:b0:1bc:6dd9:82c3 with SMTP id o4-20020a170902d4c400b001bc6dd982c3mr923062plg.37.1691526863456; Tue, 08 Aug 2023 13:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691526863; cv=none; d=google.com; s=arc-20160816; b=GHm79Qh63TsGmgEiO3oYto+2s3IRwJVOUbX4pjf8qtFX5Th7M7kFgeGTIpT/sUML8G IZllFCrM98GboZy+LUTqaOHqoLwSzPHHI3P5YE2LXhaWsgdznu3UHDFfJzUh9iDJbRp3 yRvfrD7tyUJG0QLieuAEpDccDWQXYe7SC4tEAPy6cvCTl2mQpU1UlS7sSg3SPr6wtOiX P0RPJr2p46JAMfA3n3hMMXxy7kyLsSVPKxjeH7ZeFF0u/Ha9QXS/f65Wl351AMRdPEuF b1hGmkt0fGb3ajZIr5JkqZG7NuKJIA8TAtshdulyZsdSTqK6XwnoQYE3wABnItgS5EQg mJxQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d9-20020a170902654900b001b54bdd6412si7985898pln.396.2023.08.08.13.34.10; Tue, 08 Aug 2023 13:34:23 -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 S229844AbjHHTyP (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Tue, 8 Aug 2023 15:54:15 -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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; 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 <n.zhandarovich@fintech.ru> To: Alex Deucher <alexander.deucher@amd.com>, "Pan, Xinhui" <Xinhui.Pan@amd.com> CC: Nikita Zhandarovich <n.zhandarovich@fintech.ru>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Dave Airlie <airlied@redhat.com>, <amd-gfx@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>, <lvc-project@linuxtesting.org> 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773694472368726222 X-GMAIL-MSGID: 1773694472368726222 |
Series |
drm/radeon: check return value of radeon_ring_lock()
|
|
Commit Message
Nikita Zhandarovich
Aug. 8, 2023, 6:04 p.m. UTC
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 <n.zhandarovich@fintech.ru>
---
drivers/gpu/drm/radeon/si.c | 4 ++++
1 file changed, 4 insertions(+)
Comments
Applied. Thanks! On Tue, Aug 8, 2023 at 2:08 PM Nikita Zhandarovich <n.zhandarovich@fintech.ru> wrote: > > 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 <n.zhandarovich@fintech.ru> > --- > 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 >
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));