Bluetooth: Host: Fix overwriting ECC error value

Jump straight to the exit portion of the function in the case that
psa_destroy_key() failed and we set err to a non-zero value. This also
fixes Coverity CID 487701 "Code maintainability issues  (UNUSED_VALUE)".

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
This commit is contained in:
Johan Hedberg 2025-01-27 16:32:27 +02:00 committed by Benjamin Cabé
parent e0a9bd7312
commit 8b356fd9fb

View File

@ -213,6 +213,7 @@ static void generate_dh_key(struct k_work *work)
if (psa_destroy_key(key_id) != PSA_SUCCESS) {
LOG_ERR("Failed to destroy the key");
err = -EIO;
goto exit;
}
err = 0;