git: 699eed180783 - stable/13 - mlx5: Don't give zero number of pages to the firmware.

From: Hans Petter Selasky <hselasky_at_FreeBSD.org>
Date: Sun, 30 Apr 2023 06:58:17 UTC
The branch stable/13 has been updated by hselasky:

URL: https://cgit.FreeBSD.org/src/commit/?id=699eed1807838c743f8ce804b23c61e4ca51f3e8

commit 699eed1807838c743f8ce804b23c61e4ca51f3e8
Author:     Hans Petter Selasky <hselasky@FreeBSD.org>
AuthorDate: 2023-04-18 11:22:41 +0000
Commit:     Hans Petter Selasky <hselasky@FreeBSD.org>
CommitDate: 2023-04-30 06:56:19 +0000

    mlx5: Don't give zero number of pages to the firmware.
    
    Can happen when using virtual mlx5_core<N> functions, VFs.
    
    Sponsored by:   NVIDIA Networking
    
    (cherry picked from commit 95bf70a4bf7982091bb59200bc2db2cb5cd840d7)
---
 sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c b/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
index d298da67057a..730c7ee8bee9 100644
--- a/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
+++ b/sys/dev/mlx5/mlx5_core/mlx5_pagealloc.c
@@ -509,7 +509,10 @@ int mlx5_satisfy_startup_pages(struct mlx5_core_dev *dev, int boot)
 	mlx5_core_dbg(dev, "requested %d %s pages for func_id 0x%x\n",
 		      npages, boot ? "boot" : "init", func_id);
 
-	return give_pages(dev, func_id, npages, 0);
+	if (npages > 0)
+		return give_pages(dev, func_id, npages, 0);
+	else
+		return 0;
 }
 
 enum {