From nobody Tue Dec 16 16:37:05 2025 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (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 8C80D322B8C for ; Wed, 10 Dec 2025 13:26:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765373173; cv=none; b=IHqYPacF+7F+fJ1NB8noFIGL/e9vsCBI9+8cUxEU9TS+/yEnoZVROjEHPrDjsqIpA76T9U3ZJHP6z42THciqUSE2Vfzgy6ySXw470D/NAq+NKhwneJgfYcRmJENowc6g23dv3o8rZy+IUYp1ERNp8cAgQQGYK0jW2y+owfXoqCQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765373173; c=relaxed/simple; bh=RzzJQFSmpdq3ZSqyZ5ANenrhQzDOIUGBRt1+lLf/IO0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=l29VhLiCUSqnbHTGnkoy8mOwrfm+1R7jbt8XvSIfSsXQaaTpSe8r35+jLl3h3g9IxmC+L1GtVU+atmU/p28Txn/wUt3iBO53TjEaXHvlkFgp2hXEK1zxbo99HJNu+pVR1jvKArKRS95RNQnCHV0LFzRS95UwTIXIxLcXtUlQX7w= 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=X6bYrlQC; arc=none smtp.client-ip=91.218.175.174 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="X6bYrlQC" 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=1765373169; 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=n0xFNj1VFPm49dVLbTKO075wSDlGhm7tuOYw6CG1Yfc=; b=X6bYrlQC9N/Ra8xiqgntw3sbaY7gUkmMaHr9kzFi2h7KzXqZX//v2QVDim/WG9O7LAMAlZ xqm0bPGl3Zzc/s4LdU2GW6HL5zfOVT0v58laRLUoLDJ8Le7g/aT9W9EAzhierT8Orv1ZnN s3TkBzvi1eotZ9Re3yym4WqJW2E+Zws= 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: scompress - Use crypto_unregister_scomps in crypto_register_scomps Date: Wed, 10 Dec 2025 14:25:48 +0100 Message-ID: <20251210132548.569689-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" Define crypto_unregister_scomps() before crypto_register_scomps() and replace the for loop with a call to crypto_unregister_scomps(). Return 'ret' immediately and remove the goto statement to simplify the error handling code. No functional changes. Signed-off-by: Thorsten Blum --- crypto/scompress.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/crypto/scompress.c b/crypto/scompress.c index 1a7ed8ae65b0..3e026a6eefe8 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c @@ -377,34 +377,30 @@ void crypto_unregister_scomp(struct scomp_alg *alg) } EXPORT_SYMBOL_GPL(crypto_unregister_scomp); =20 +void crypto_unregister_scomps(struct scomp_alg *algs, int count) +{ + int i; + + for (i =3D count - 1; i >=3D 0; --i) + crypto_unregister_scomp(&algs[i]); +} +EXPORT_SYMBOL_GPL(crypto_unregister_scomps); + int crypto_register_scomps(struct scomp_alg *algs, int count) { int i, ret; =20 for (i =3D 0; i < count; i++) { ret =3D crypto_register_scomp(&algs[i]); - if (ret) - goto err; + if (ret) { + crypto_unregister_scomps(algs, i); + return ret; + } } =20 return 0; - -err: - for (--i; i >=3D 0; --i) - crypto_unregister_scomp(&algs[i]); - - return ret; } EXPORT_SYMBOL_GPL(crypto_register_scomps); =20 -void crypto_unregister_scomps(struct scomp_alg *algs, int count) -{ - int i; - - for (i =3D count - 1; i >=3D 0; --i) - crypto_unregister_scomp(&algs[i]); -} -EXPORT_SYMBOL_GPL(crypto_unregister_scomps); - MODULE_LICENSE("GPL"); MODULE_DESCRIPTION("Synchronous compression type"); --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4