From nobody Tue Dec 16 13:51:34 2025 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 CCB6EC25B6B for ; Thu, 26 Oct 2023 02:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233176AbjJZCL5 (ORCPT ); Wed, 25 Oct 2023 22:11:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjJZCL4 (ORCPT ); Wed, 25 Oct 2023 22:11:56 -0400 Received: from mail.nfschina.com (unknown [42.101.60.195]) by lindbergh.monkeyblade.net (Postfix) with SMTP id B68DC133; Wed, 25 Oct 2023 19:11:53 -0700 (PDT) Received: from localhost.localdomain (unknown [180.167.10.98]) by mail.nfschina.com (Maildata Gateway V2.8.8) with ESMTPA id D187E605FCF04; Thu, 26 Oct 2023 10:11:12 +0800 (CST) X-MD-Sfrom: suhui@nfschina.com X-MD-SrcIP: 180.167.10.98 From: Su Hui To: lukas@wunner.de, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch Cc: Su Hui , tiwai@suse.de, Jim.Qu@amd.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] vga_switcheroo: Fix impossible judgment condition Date: Thu, 26 Oct 2023 10:10:57 +0800 Message-Id: <20231026021056.850680-1-suhui@nfschina.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 'id' is enum type like unsigned int, so it will never be less than zero. Fixes: 4aaf448fa975 ("vga_switcheroo: set audio client id according to boun= d GPU id") Signed-off-by: Su Hui --- drivers/gpu/vga/vga_switcheroo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switche= roo.c index 365e6ddbe90f..d3064466fd3a 100644 --- a/drivers/gpu/vga/vga_switcheroo.c +++ b/drivers/gpu/vga/vga_switcheroo.c @@ -375,7 +375,7 @@ int vga_switcheroo_register_audio_client(struct pci_dev= *pdev, mutex_lock(&vgasr_mutex); if (vgasr_priv.active) { id =3D vgasr_priv.handler->get_client_id(vga_dev); - if (id < 0) { + if ((int)id < 0) { mutex_unlock(&vgasr_mutex); return -EINVAL; } --=20 2.30.2