Merge tag 'rust-i2c-7.1-rc7' of https://github.com/ikrtn/linux into i2c/for-current

rust: i2c: fix I2cAdapter refcount double increment
This commit is contained in:
Wolfram Sang committed 2026-06-08 09:47:50 +02:00
commit b3f240cca1
1 file changed
+3 -1
+3 -1
View File
@@ -405,7 +405,9 @@ impl I2cAdapter {
// SAFETY: `adapter` is non-null and points to a live `i2c_adapter`.
// `I2cAdapter` is #[repr(transparent)], so this cast is valid.
Ok(unsafe { (&*adapter.as_ptr().cast::<I2cAdapter<device::Normal>>()).into() })
// `i2c_get_adapter` returned the adapter with an incremented refcount, which we pass to
// the `ARef`.
Ok(unsafe { ARef::from_raw(adapter.cast::<I2cAdapter<device::Normal>>()) })
}
}