[PATCH 1/3] rust_binder: start debug_id at 1

From: Alice Ryhl

Date: Wed Sep 30 2026 - 09:02:23 EST


In the C Binder driver, debug IDs are allocated with
atomic_inc_return(&binder_last_id), so valid debug IDs start at 1 and 0
is never assigned.

Start NEXT_DEBUG_ID at 1 in Rust Binder as well so that 0 can be used as
a sentinel for an absent or uninitialized debug_id (such as in
TransactionInfo::to_node_debug_id and in transaction log entries).

Assisted-by: LLM
Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
---
drivers/android/binder/rust_binder_main.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/android/binder/rust_binder_main.rs b/drivers/android/binder/rust_binder_main.rs
index 955c4c348f73..e360df991d51 100644
--- a/drivers/android/binder/rust_binder_main.rs
+++ b/drivers/android/binder/rust_binder_main.rs
@@ -96,7 +96,7 @@ fn default() -> Self {
};

fn next_debug_id() -> usize {
- static NEXT_DEBUG_ID: Atomic<usize> = Atomic::new(0);
+ static NEXT_DEBUG_ID: Atomic<usize> = Atomic::new(1);

NEXT_DEBUG_ID.fetch_add(1, Relaxed)
}

--
2.56.0.rc1.315.gc6ed9934b7-goog