diff options
author | Joel Fernandes (Google) <joel@joelfernandes.org> | 2023-07-29 14:27:32 +0000 |
---|---|---|
committer | Frederic Weisbecker <frederic@kernel.org> | 2023-09-13 22:27:41 +0200 |
commit | f0a31b26be1f725e3f56beed76486c1b034120b3 (patch) | |
tree | 5f6e7c6e0c0f62597f6b3f7800969cce50afd901 /drivers/tty/serial/esp32_acm.c | |
parent | ff18cb816427c3738d5d3fd23b7939a813935e15 (diff) |
srcu: Fix error handling in init_srcu_struct_fields()
The current error handling in init_srcu_struct_fields() is a bit
inconsistent. If init_srcu_struct_nodes() fails, the function either
returns -ENOMEM or 0 depending on whether ssp->sda_is_static is true or
false. This can make init_srcu_struct_fields() return 0 even if memory
allocation failed!
Simplify the error handling by always returning -ENOMEM if either
init_srcu_struct_nodes() or the per-CPU allocation fails. This makes the
control flow easier to follow and avoids the inconsistent return values.
Add goto labels to avoid duplicating the error cleanup code.
Link: https://lore.kernel.org/r/20230404003508.GA254019@google.com
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Diffstat (limited to 'drivers/tty/serial/esp32_acm.c')
0 files changed, 0 insertions, 0 deletions