git: 78155442c297 - stable/13 - nexus: Consistently return a pointer in failure paths

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 02 Jun 2023 13:17:27 UTC
The branch stable/13 has been updated by markj:

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

commit 78155442c297272006185a2b3946033ae5d1cd04
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-04-26 21:19:28 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-06-02 13:16:55 +0000

    nexus: Consistently return a pointer in failure paths
    
    No functional change intended.
    
    MFC after:      1 week
    
    (cherry picked from commit ca4c7859009549975229d854888231e48938035e)
---
 sys/arm/arm/nexus.c | 2 +-
 sys/x86/x86/nexus.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/arm/arm/nexus.c b/sys/arm/arm/nexus.c
index d0894f3823ef..a0da03a80328 100644
--- a/sys/arm/arm/nexus.c
+++ b/sys/arm/arm/nexus.c
@@ -256,7 +256,7 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
 	if (needactivate) {
 		if (bus_activate_resource(child, type, *rid, rv)) {
 			rman_release_resource(rv);
-			return (0);
+			return (NULL);
 		}
 	}
 
diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c
index fc3cdc3c24f3..a8a800fd8b32 100644
--- a/sys/x86/x86/nexus.c
+++ b/sys/x86/x86/nexus.c
@@ -389,13 +389,13 @@ nexus_alloc_resource(device_t bus, device_t child, int type, int *rid,
 
 	rv = rman_reserve_resource(rm, start, end, count, flags, child);
 	if (rv == NULL)
-		return (0);
+		return (NULL);
 	rman_set_rid(rv, *rid);
 
 	if (needactivate) {
 		if (bus_activate_resource(child, type, *rid, rv)) {
 			rman_release_resource(rv);
-			return (0);
+			return (NULL);
 		}
 	}