git: 92b352f694e8 - main - gpiobus: gpio_pin_release: convert checks to KASSERTs

From: Ahmad Khalifa <vexeduxr_at_FreeBSD.org>
Date: Fri, 04 Jul 2025 20:26:08 UTC
The branch main has been updated by vexeduxr:

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

commit 92b352f694e83827252d42a58df3c6e4dd0e0164
Author:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
AuthorDate: 2025-07-04 20:02:57 +0000
Commit:     Ahmad Khalifa <vexeduxr@FreeBSD.org>
CommitDate: 2025-07-04 20:24:31 +0000

    gpiobus: gpio_pin_release: convert checks to KASSERTs
    
    Reviewed by:    mmel, imp
    Approved by:    imp (mentor)
    Differential Revision:  https://reviews.freebsd.org/D50868
---
 sys/dev/gpio/gpiobus.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sys/dev/gpio/gpiobus.c b/sys/dev/gpio/gpiobus.c
index e919561340a8..c28fac66115b 100644
--- a/sys/dev/gpio/gpiobus.c
+++ b/sys/dev/gpio/gpiobus.c
@@ -218,15 +218,13 @@ gpio_pin_release(gpio_pin_t gpio)
 {
 	device_t busdev;
 
-	if (gpio == NULL)
-		return;
-
+	KASSERT(gpio != NULL, ("GPIO pin is NULL."));
 	KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL."));
 
 	busdev = GPIO_GET_BUS(gpio->dev);
-	if (busdev != NULL)
-		gpiobus_release_pin(busdev, gpio->pin);
+	KASSERT(busdev != NULL, ("gpiobus dev is NULL."));
 
+	gpiobus_release_pin(busdev, gpio->pin);
 	free(gpio, M_DEVBUF);
 }