git: e17d7f3d86b0 - stable/13 - LinuxKPI: fix -Wunused-but-set-variable warnings

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 30 Dec 2021 19:22:32 UTC
The branch stable/13 has been updated by bz:

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

commit e17d7f3d86b0a323126ae471025924f49e596ee0
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2021-11-24 21:20:52 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2021-12-30 18:25:15 +0000

    LinuxKPI: fix -Wunused-but-set-variable warnings
    
    Handle write-only variables by removing the unused return value from void
    functions or removing the unused variables entirely.
    
    Sponsored by:   The FreeBSD Foundation
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D33107
    
    (cherry picked from commit 7043359ce3c1e56ed55c8b41867a14a418511a05)
---
 sys/compat/linuxkpi/common/src/linux_firmware.c | 3 +--
 sys/compat/linuxkpi/common/src/linux_pci.c      | 4 ----
 sys/compat/linuxkpi/common/src/linux_usb.c      | 8 +++-----
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/sys/compat/linuxkpi/common/src/linux_firmware.c b/sys/compat/linuxkpi/common/src/linux_firmware.c
index d779b509105e..47cccd42da20 100644
--- a/sys/compat/linuxkpi/common/src/linux_firmware.c
+++ b/sys/compat/linuxkpi/common/src/linux_firmware.c
@@ -150,7 +150,6 @@ lkpi_fw_task(void *ctx, int pending)
 {
 	struct lkpi_fw_task *lfwt;
 	const struct linuxkpi_firmware *fw;
-	int error;
 
 	KASSERT(ctx != NULL && pending == 1, ("%s: lfwt %p, pending %d\n",
 	    __func__, ctx, pending));
@@ -159,7 +158,7 @@ lkpi_fw_task(void *ctx, int pending)
 	if (lfwt->cont == NULL)
 		goto out;
 
-	error = _linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev,
+	_linuxkpi_request_firmware(lfwt->fw_name, &fw, lfwt->dev,
 	    lfwt->gfp, true, true);
 
 	/*
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index db94bc08239e..1c562b74c95a 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -1060,11 +1060,9 @@ dma_pool_obj_import(void *arg, void **store, int count, int domain __unused,
     int flags)
 {
 	struct dma_pool *pool = arg;
-	struct linux_dma_priv *priv;
 	struct linux_dma_obj *obj;
 	int error, i;
 
-	priv = pool->pool_device->dma_priv;
 	for (i = 0; i < count; i++) {
 		obj = uma_zalloc(linux_dma_obj_zone, flags);
 		if (obj == NULL)
@@ -1087,11 +1085,9 @@ static void
 dma_pool_obj_release(void *arg, void **store, int count)
 {
 	struct dma_pool *pool = arg;
-	struct linux_dma_priv *priv;
 	struct linux_dma_obj *obj;
 	int i;
 
-	priv = pool->pool_device->dma_priv;
 	for (i = 0; i < count; i++) {
 		obj = store[i];
 		bus_dmamem_free(pool->pool_dmat, obj->vaddr, obj->dmamap);
diff --git a/sys/compat/linuxkpi/common/src/linux_usb.c b/sys/compat/linuxkpi/common/src/linux_usb.c
index e93559f95264..11f400bc2c52 100644
--- a/sys/compat/linuxkpi/common/src/linux_usb.c
+++ b/sys/compat/linuxkpi/common/src/linux_usb.c
@@ -1185,15 +1185,14 @@ usb_linux_free_device(struct usb_device *dev)
 {
 	struct usb_host_endpoint *uhe;
 	struct usb_host_endpoint *uhe_end;
-	int err;
 
 	uhe = dev->linux_endpoint_start;
 	uhe_end = dev->linux_endpoint_end;
 	while (uhe != uhe_end) {
-		err = usb_setup_endpoint(dev, uhe, 0);
+		usb_setup_endpoint(dev, uhe, 0);
 		uhe++;
 	}
-	err = usb_setup_endpoint(dev, &dev->ep0, 0);
+	usb_setup_endpoint(dev, &dev->ep0, 0);
 	free(dev->linux_endpoint_start, M_USBDEV);
 }
 
@@ -1276,7 +1275,6 @@ usb_linux_cleanup_interface(struct usb_device *dev, struct usb_interface *iface)
 	struct usb_host_interface *uhi_end;
 	struct usb_host_endpoint *uhe;
 	struct usb_host_endpoint *uhe_end;
-	int err;
 
 	uhi = iface->altsetting;
 	uhi_end = iface->altsetting + iface->num_altsetting;
@@ -1284,7 +1282,7 @@ usb_linux_cleanup_interface(struct usb_device *dev, struct usb_interface *iface)
 		uhe = uhi->endpoint;
 		uhe_end = uhi->endpoint + uhi->desc.bNumEndpoints;
 		while (uhe != uhe_end) {
-			err = usb_setup_endpoint(dev, uhe, 0);
+			usb_setup_endpoint(dev, uhe, 0);
 			uhe++;
 		}
 		uhi++;