@@ -72,17 +72,15 @@ impl FileDescription for Event {
72
72
// Check the size of slice, and return error only if the size of the slice < 8.
73
73
if len < U64_ARRAY_SIZE . try_into ( ) . unwrap ( ) {
74
74
let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
75
- return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ?;
76
- return Ok ( ( ) ) ;
75
+ return return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ;
77
76
}
78
77
79
78
// Block when counter == 0.
80
79
let counter = self . counter . get ( ) ;
81
80
if counter == 0 {
82
81
if self . is_nonblock {
83
82
let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
84
- return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ?;
85
- return Ok ( ( ) ) ;
83
+ return return_read_bytes_and_count_ev ( & buf_place, None , result, dest, ecx) ;
86
84
} else {
87
85
//FIXME: blocking is not supported
88
86
throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
@@ -91,13 +89,12 @@ impl FileDescription for Event {
91
89
// Synchronize with all prior `write` calls to this FD.
92
90
ecx. acquire_clock ( & self . clock . borrow ( ) ) ;
93
91
let result = Ok ( U64_ARRAY_SIZE ) ;
94
- return_read_bytes_and_count_ev ( & buf_place, Some ( counter) , result, dest, ecx) ?;
95
92
self . counter . set ( 0 ) ;
96
93
// When any of the event happened, we check and update the status of all supported event
97
94
// types for current file description.
98
95
ecx. check_and_update_readiness ( self_ref) ?;
99
96
100
- return Ok ( ( ) ) ;
97
+ return_read_bytes_and_count_ev ( & buf_place , Some ( counter ) , result , dest , ecx )
101
98
}
102
99
}
103
100
@@ -124,8 +121,7 @@ impl FileDescription for Event {
124
121
// Check the size of slice, and return error only if the size of the slice < 8.
125
122
let Some ( bytes) = bytes. first_chunk :: < U64_ARRAY_SIZE > ( ) else {
126
123
let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
127
- ecx. return_written_byte_count_or_error ( result, dest) ?;
128
- return Ok ( ( ) ) ;
124
+ return ecx. return_written_byte_count_or_error ( result, dest) ;
129
125
} ;
130
126
// Convert from bytes to int according to host endianness.
131
127
let num = match ecx. tcx . sess . target . endian {
@@ -135,8 +131,7 @@ impl FileDescription for Event {
135
131
// u64::MAX as input is invalid because the maximum value of counter is u64::MAX - 1.
136
132
if num == u64:: MAX {
137
133
let result = Err ( Error :: from ( ErrorKind :: InvalidInput ) ) ;
138
- ecx. return_written_byte_count_or_error ( result, dest) ?;
139
- return Ok ( ( ) ) ;
134
+ return ecx. return_written_byte_count_or_error ( result, dest) ;
140
135
}
141
136
// If the addition does not let the counter to exceed the maximum value, update the counter.
142
137
// Else, block.
@@ -151,8 +146,7 @@ impl FileDescription for Event {
151
146
None | Some ( u64:: MAX ) => {
152
147
if self . is_nonblock {
153
148
let result = Err ( Error :: from ( ErrorKind :: WouldBlock ) ) ;
154
- ecx. return_written_byte_count_or_error ( result, dest) ?;
155
- return Ok ( ( ) ) ;
149
+ return ecx. return_written_byte_count_or_error ( result, dest) ;
156
150
} else {
157
151
//FIXME: blocking is not supported
158
152
throw_unsup_format ! ( "eventfd: blocking is unsupported" ) ;
@@ -164,8 +158,7 @@ impl FileDescription for Event {
164
158
ecx. check_and_update_readiness ( self_ref) ?;
165
159
166
160
let result = Ok ( U64_ARRAY_SIZE ) ;
167
- ecx. return_written_byte_count_or_error ( result, dest) ?;
168
- Ok ( ( ) )
161
+ ecx. return_written_byte_count_or_error ( result, dest)
169
162
}
170
163
}
171
164
0 commit comments