From nobody Sun Feb 8 13:09:05 2026 Received: from out-179.mta1.migadu.com (out-179.mta1.migadu.com [95.215.58.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4406D8632B for ; Sun, 1 Feb 2026 17:57:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769968658; cv=none; b=dVXn1Vv7iU9EzbOUOMgzDBnj3BeA2RlMkQlkos97zQlnsuoCRPx+X8u4zmwX9zCFnzJ5Fg9ka9RD+snP0hdsv1xIA7J8/CWvwapbiKdRvvkxlpciTtrm5EvzCPoPcnbZHiexemhPfoKK634KgQ3jN16X1jXI+3YuJMEIDWDRnDg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769968658; c=relaxed/simple; bh=HRBBj0nPq7qU55R3IPHOngXEvBb3wwpPQ7k4n533wrc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l0UbvB/cMb9a8k14CBkp/N8NEcbBJK2/7T9ac0u/Hqv/Db3BtTOFlpoV/8UhZ7cV3MY+OfQq7ouKQ6eSY9+LRRY3zR4tTkbXW6JK+ny0NH1rroiiJesWXf6G66X/xKMgq/cY7UwFVxBDg3UqpkukZ2tNmWn94GZeAonF7Bb+R24= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=DsN4ltz4; arc=none smtp.client-ip=95.215.58.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="DsN4ltz4" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1769968644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pWD89ORk2rwOefxQ8yqPj9t/reTFvE2D7mE1erXtzWc=; b=DsN4ltz47LFzz+FP/6VNpbbyaIEC9zf/s79KNqe87N94SixmnHa3t6G7J79WVBeF7LDMm+ NwuY13MHSZD0DoKuTEdDT+jafWLoxAyTO7NjekmNnx0O5uQw9lgaXMUM4cR0OVHN3dLT2r VWz+jgBnnGYQ9Rf81ITJ4aZADyxVlIs= From: Thorsten Blum To: Herbert Xu , "David S. Miller" Cc: Thorsten Blum , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: img-hash - Use unregister_ahashes in img_{un}register_algs Date: Sun, 1 Feb 2026 18:56:33 +0100 Message-ID: <20260201175632.662976-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Replace the for loops with calls to crypto_unregister_ahashes(). In img_register_algs(), return 'err' immediately and remove the goto statement to simplify the error handling code. Convert img_unregister_algs() to a void function since its return value is never used. Signed-off-by: Thorsten Blum --- drivers/crypto/img-hash.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c index f22c12e36b56..7195c37dd102 100644 --- a/drivers/crypto/img-hash.c +++ b/drivers/crypto/img-hash.c @@ -870,25 +870,18 @@ static int img_register_algs(struct img_hash_dev *hde= v) =20 for (i =3D 0; i < ARRAY_SIZE(img_algs); i++) { err =3D crypto_register_ahash(&img_algs[i]); - if (err) - goto err_reg; + if (err) { + crypto_unregister_ahashes(img_algs, i); + return err; + } } - return 0; =20 -err_reg: - for (; i--; ) - crypto_unregister_ahash(&img_algs[i]); - - return err; + return 0; } =20 -static int img_unregister_algs(struct img_hash_dev *hdev) +static void img_unregister_algs(struct img_hash_dev *hdev) { - int i; - - for (i =3D 0; i < ARRAY_SIZE(img_algs); i++) - crypto_unregister_ahash(&img_algs[i]); - return 0; + crypto_unregister_ahashes(img_algs, ARRAY_SIZE(img_algs)); } =20 static void img_hash_done_task(unsigned long data) --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4