From patchwork Sun Aug 21 20:52:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 9292777 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B76CE608A7 for ; Mon, 22 Aug 2016 00:40:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA1A0287DE for ; Mon, 22 Aug 2016 00:40:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EFA4287EA; Mon, 22 Aug 2016 00:40:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 56584287FF for ; Mon, 22 Aug 2016 00:40:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54FE26E2AE; Mon, 22 Aug 2016 00:40:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9140D6E156 for ; Sun, 21 Aug 2016 20:52:38 +0000 (UTC) Received: from workstation4.fritz.box ([109.91.48.91]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0LxPuE-1b4GH70ZUg-016vZA; Sun, 21 Aug 2016 22:52:31 +0200 From: Heinrich Schuchardt To: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 1/1] drm/radeon: avoid NULL dereference, si_get_vce_clock_voltage Date: Sun, 21 Aug 2016 22:52:23 +0200 Message-Id: <1471812743-5095-1-git-send-email-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.1.4 X-Provags-ID: V03:K0:vWLRIytAdj5Rto7eyQ2CMRRKKFSEUyMMM5Ftr9fXJXKX8yc9aDj J8FlvrBViPG+bjDm6KmIdUVc7lLfyZ2/OH0TyHNOkaSHwtAVnJJUYyi+Zud8WdJW2FVcQ0I qGGRxQboDu+C522uQx1qQ4rBRxC06EOfHlv5kD+IrZoVECE/zvZK7aaIJ5tsJYNp48IJcz7 wsruMoQrI83pfRUDHvXQg== X-UI-Out-Filterresults: notjunk:1; V01:K0:ldb+jwgxFpw=:SRZHDb3vhXLK0X7BiW3mgy HiQ5yLeVRBphbkd3LTm5JakjfAgTb7Icz8r7ys+zYkP4Drjs7p+fghhs9lipa0EnO+aEbGIyW Stx9gj+AWYofjGLWb+3PLT4Kkl6kkCuD7JXJqWhW/DuTnOsvy0fNsbmvIClK+JzVBbl0C1vqq 0pDIJlViKCJAuZ2AGZ4C9pdkA9DEFXGx/BIBy38/Ac2X1CPuufzYOKaWhFvbY2EqeCuJfcuS3 NHvDTncdKWGooAoRtADvbCaPe0dnPr/bpsJc8sG22qScm1/KxyqcgoW/yDdKZLhDfRmJSazQ+ YhBCplGw8oGV2F94U3k1KI/omedfUi49MjjRAv/nmqbjwoMK1vtSBKBHxAt1Ia9q8RnoPZ1ix XYOzgxM2Uz+bhOTqX7H5kljOBTkxj5bSsVt2qHxrNgdeFqO3usI0pMTKVCaLY5RgekhkVfcGD d5+azm1X+/tJ7en6rGu8VbpJW1Qs/hy2C1KcYp68a7zanhWWAdy5IWIuixUy7j9Znj5w0UHqS LFhKs/Exnr+JXDY/91SoWqDx/a5dhuXNRD1fm+SrrTywCfpqNOWeidza/CnANyy0K6RbWcfby vscZfsvgk2tV44cADLeDVWktSgft9VgJcoWtNPka1fHhOIMBLUocPI+bUGlJDWF71r08PzG1t O8D3/AO9mO5RKqyrbiTtcHiFPBywFbsIOGzIuJYIeoixmIo0oP7EtES0xqxDZ5gnpiYZDmM6e yL7uxKLSjGsk+Dt1J4pNxDUSbmcTZRYmDNPMBTHOH8mAR8FaaShiOsXlLko= X-Mailman-Approved-At: Mon, 22 Aug 2016 00:39:59 +0000 Cc: Heinrich Schuchardt , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP It does not make sense to check if table is NULL and afterwards to dereference it without considering the result. The inconsistency was indicated by cppcheck. An actual NULL pointer dereference was not observed. Signed-off-by: Heinrich Schuchardt --- drivers/gpu/drm/radeon/si_dpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c index e6abc09..ba2cf12 100644 --- a/drivers/gpu/drm/radeon/si_dpm.c +++ b/drivers/gpu/drm/radeon/si_dpm.c @@ -2962,7 +2962,7 @@ static int si_get_vce_clock_voltage(struct radeon_device *rdev, &rdev->pm.dpm.dyn_state.vce_clock_voltage_dependency_table; if (((evclk == 0) && (ecclk == 0)) || - (table && (table->count == 0))) { + table == NULL || table->count == 0) { *voltage = 0; return 0; }