From nobody Fri Dec 19 20:58:23 2025 Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF49E33086 for ; Wed, 8 Jan 2025 09:15:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736327760; cv=none; b=SxpYLK8ycZtxzSD8oE1BYVgEFXNGOVwvu9Xz8lJXjgFulKVaFKAu5ps5t3/li1qfsT4782HJ0sRyIrDwMB/5w1Rnfgp6tnfjTV5qfuOIktif5Qgw42VO5anttcCDHyE3aFkvV0EvQsBzuKahwFK/0Vfsi9Zgfngav+pix1h5CW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736327760; c=relaxed/simple; bh=BDpuea0x98xGaOH/brrQV7qpk2foL2fZltIoQWXcJDA=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=OfWoDO3Ql2mR58zv7z3gIcIH9bwtOXw8WCnZ/FbK5NLfsx2EQHot5Ww87UQqtxEX/nSdxlwKvYaS+5w7aQcH0XvM3IkzoxS5lB22QN2DCkpKZpx7YP3iCVUm9ZZyCMzLesKqdIpdyW3cebpYvI8wUvqQa9x+2DWHS/czmCDAtXA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MFum00QC; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MFum00QC" Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-38633b5dbcfso15817904f8f.2 for ; Wed, 08 Jan 2025 01:15:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736327757; x=1736932557; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=dNfHlg7+rOJqYIBrKsr5HH/Jvz6rLd05OrWMK+Cy6zQ=; b=MFum00QC+j+d2mDTtauIYhucJVzVSaefzQSYr0BELxxO4n8ZMI3/t/xelRNB20uLMV 19QEeoK0D3SlizjyiBCfEZBovA8kB2ZuiihrzMrLIACtClH3m9Zm9gvSAmg29tcxRiu5 tR0d24pR4Zz0NQKmBPgA7BQur9idFhEmh1RJydjceV/qU2inuT11wrzhDbQz4js4uyWN APDle9opOL1PePRtJ3xiPyOEB+g22/bB3MGP6Mz3wfS5qwDODQJFloFGPgxs9P5iBkhr 5umBydSjkyRDo3dPQpRY1zdhuie0sACntlxlkHIhb/X+LnyxQuY4Muqs+Bp2uN+UUnx4 R+bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736327757; x=1736932557; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dNfHlg7+rOJqYIBrKsr5HH/Jvz6rLd05OrWMK+Cy6zQ=; b=NqrAM+XoB4OekHs2yvji1P4do39E4nRIlcIaD8A1D8Qydie2wLCeZ3ndGwl7oJ+MPN KS0sz8hE2iIJZIMdVAnCbVOvLVGl42DAcmxXSZON0UwbqrJSRrt7ZG1mXYg0oex+KKuh usl/a7/TSIuciFjY6Bkp9V6isTAa2bF8h04fNJBzcqSmi7MnnXThP1qpIDwidAu2Dgon M+ksMbFairsH5l5uMgZ8mUtAvgNuj0QNshiecKJfpKCDGgP7nYveh+fcoZrVsxYbN9an OhF40w6nGjuBASgd/1iEO/bxL92O0mi028OOTmOzqHC5/v7OlH/dj1CD4jHKU/SBdXlE u7ng== X-Forwarded-Encrypted: i=1; AJvYcCWeH0yeIZ6kF4sEnt8T8pnxxluWo1dwPEEdmJK/nZVH/kab5We1oJdSP4tPaWplQjJTcC6Jcc1y07zqIVI=@vger.kernel.org X-Gm-Message-State: AOJu0YxTzW1GQxBtb5tV2xjKawW06M2YfKOSLyhxigckaot5RlBXRZxX hmz3QaX6x52kp5uddZhczCGmyRWWPrBCHlwI3dwewVYpB/6TaDsnX/ghcOyZzW4= X-Gm-Gg: ASbGncuEjN5JWRj/AVFZtUFlJuFca0i0E+BOdHmYh6JeBWkeFO7ogo97ABCVcTrIa0n RAl82pUSDTLkJ2bp82kiFWo+uSXevQraa8I/12BQgnEOODPX4r0+C3xz9Gzbu73ur5ciFBQAXCO mQCqRHBOAMNBl3NdzdAlgnCgndyLm8X9IP/DDrSeSLhjbntCLZPEqkCEaN1ypVEsL/2BiG+zMxb 2r5Ic0DhZ4H1vIysCB48gSxBN9ygr7uc7RturfzmvZB9wPCRdMTpv7XaMvMOg== X-Google-Smtp-Source: AGHT+IHCY6wO+12ioIIeFx5QBHEz/z5fXqeEkaIQcWC8b/Zkck8otn4DFulJBJDQ/f9lbUQDLV7jiQ== X-Received: by 2002:a05:6000:4714:b0:386:33e3:853c with SMTP id ffacd0b85a97d-38a872fc034mr1308522f8f.12.1736327757259; Wed, 08 Jan 2025 01:15:57 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c832e31sm51691430f8f.33.2025.01.08.01.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 01:15:56 -0800 (PST) Date: Wed, 8 Jan 2025 12:15:53 +0300 From: Dan Carpenter To: Justin Lai Cc: Larry Chiu , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH net] rtase: Fix a check for error in rtase_alloc_msix() Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The pci_irq_vector() function never returns zero. It returns negative error codes or a positive non-zero IRQ number. Fix the error checking to test for negatives. Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module") Signed-off-by: Dan Carpenter Reviewed-by: Kalesh AP Reviewed-by: Simon Horman --- For more information about the history of IRQ returns see my blog: https://staticthinking.wordpress.com/2023/08/07/writing-a-check-for-zero-ir= q-error-codes/ drivers/net/ethernet/realtek/rtase/rtase_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/= ethernet/realtek/rtase/rtase_main.c index 585d0b21c9e0..3bd11cb56294 100644 --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c @@ -1828,7 +1828,7 @@ static int rtase_alloc_msix(struct pci_dev *pdev, str= uct rtase_private *tp) =20 for (i =3D 0; i < tp->int_nums; i++) { irq =3D pci_irq_vector(pdev, i); - if (!irq) { + if (irq < 0) { pci_disable_msix(pdev); return irq; } --=20 2.45.2