Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp128119rdh; Wed, 25 Oct 2023 19:12:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEWYccnwpzPOur6pabmJYmy78inNWCMXhRuRGEAiaNBYqs8d+FiZSyFwgYDIoDz/LKjuKfy X-Received: by 2002:a81:ef0f:0:b0:5ae:dff7:6159 with SMTP id o15-20020a81ef0f000000b005aedff76159mr674574ywm.18.1698286334211; Wed, 25 Oct 2023 19:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698286334; cv=none; d=google.com; s=arc-20160816; b=rx73sSPMtFiuTtNSKhOt6yGrwQv1FCrdKMSVNPm/Qpatax2QqscCCe3lWiUJOMg2Vq IWXAqZelBGuX7ylzF/fUR5H6kA6fhmivYmFdbgB422bo4/3YjIMxUiabG9/gklE/yKn/ c6BK1FvFCqKts6FQYsREV+SIkZSOIAZSwlCT32q89Z4ZA9+WgyYysEVH2MyQlRmfzfDH YDljHJgMxjBTun9VFLGB9/XPebn3NJkZ3LqizaLM7HB9FmCWLCa5UgHk7dnoSAMB4yqZ IdHWGaGEw8vzX27Zwsdt9RrFYxN7/F8C/sw5clNcxr8f2ZADFel+VrZUk9vGTTeXt009 JcRQ== 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=RCbm0kRkdn/jdyM6SWdyn5ap5WP+6aqufeHfPWtlbb0=; fh=y+I+gmnU+DznoMrB9LI0KZIxzod4x9NdfAVnslGDjiE=; b=l+6fPgq8NdIE1hOnD6ma7pR2naKrnDJxLuf9jhhfKGv2ZmMdG/NIf3M9P4/rxDQ9G8 /QWc2dUlByc+2L4H4OlMsDYMBM57pcsqK/FbSzwDf2pBb1HK1kREwW1HwUBPGRi+4Jzp CLhcGpLcyU72ZykqpnkkEbx4l544NWehs/1rA7j0QOYsgeaGWATYIO7jhuS8i/DcOLQo ijHKcPCUv8NfQbtnZjh97wdfFVEguLOobILYCJTQCzIqarJtuRC67MK1Lr3jMwrMft9A B4ATRb1+D96WbLLMPneVc7S0anIAF5YgPKcDedB3xFZdaniNnqDvSZ1wIlX9ptz6Xvdc ZyPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id a5-20020a81bb45000000b0058650c1ea27si13350978ywl.540.2023.10.25.19.12.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 19:12:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id C775880811CF; Wed, 25 Oct 2023 19:12:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233125AbjJZCL5 (ORCPT + 99 others); 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: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 25 Oct 2023 19:12:11 -0700 (PDT) '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 bound 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_switcheroo.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 = vgasr_priv.handler->get_client_id(vga_dev); - if (id < 0) { + if ((int)id < 0) { mutex_unlock(&vgasr_mutex); return -EINVAL; } -- 2.30.2