From: Dan Streetman Date: Mon, 21 Aug 2023 21:31:56 +0000 (-0400) Subject: tpm2: simplify call to asprintf() X-Git-Tag: v255-rc1~630^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=495f2bf57ccd74c5e63040f05430e1148942b2c7;p=thirdparty%2Fsystemd.git tpm2: simplify call to asprintf() --- diff --git a/src/shared/tpm2-util.c b/src/shared/tpm2-util.c index 4b368728646..db51d46bd46 100644 --- a/src/shared/tpm2-util.c +++ b/src/shared/tpm2-util.c @@ -1759,10 +1759,8 @@ int tpm2_pcr_value_from_string(const char *arg, Tpm2PCRValue *ret_pcr_value) { * string. This does not check for validity. */ char *tpm2_pcr_value_to_string(const Tpm2PCRValue *pcr_value) { _cleanup_free_ char *index = NULL, *value = NULL; - int r; - r = asprintf(&index, "%u", pcr_value->index); - if (r < 0) + if (asprintf(&index, "%u", pcr_value->index) < 0) return NULL; const char *hash = tpm2_hash_alg_to_string(pcr_value->hash);