File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -149,14 +149,20 @@ pub struct KParamGuard<'a> {
149
149
this_module : & ' a ThisModule ,
150
150
}
151
151
152
- #[ cfg( CONFIG_SYSFS ) ]
153
152
impl < ' a > Drop for KParamGuard < ' a > {
153
+ #[ cfg( CONFIG_SYSFS ) ]
154
154
fn drop ( & mut self ) {
155
155
// SAFETY: `kernel_param_lock` will check if the pointer is null and
156
156
// use the built-in mutex in that case. The existance of `self`
157
157
// guarantees that the lock is held.
158
158
unsafe { bindings:: kernel_param_unlock ( self . this_module . 0 ) }
159
159
}
160
+
161
+ #[ cfg( not( CONFIG_SYSFS ) ) ]
162
+ fn drop ( & mut self ) {
163
+ // This just touches the `this_module` field, to prevent dead_code warnings.
164
+ let _ = self . this_module ;
165
+ }
160
166
}
161
167
162
168
/// Calculates the offset of a field from the beginning of the struct it belongs to.
You can’t perform that action at this time.
0 commit comments