From nobody Sun Dec 14 06:34:32 2025 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (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 3163C303A0F for ; Thu, 11 Dec 2025 08:53:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765443215; cv=none; b=lLFf37qBQQF7JBP8uDSilu8dSW4npaVf6+bBrGzZ5NBG0pEkZRMMvPRZzFnjnP/uY/FZNi5Ja2AJnN7TW3CaRkEK1JfrkZxBqW9rO2fWJ6mG1fFm2En3jqFJxLPQMny9F6MhcHHdhHV16RHXQFNsaGv2NEuUIWTrboeNOJTVkyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765443215; c=relaxed/simple; bh=pOFcKPk5DQIfMlC2wHMkmX070SjBf47kHS0w4TqaQv8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XjbEifNvhEm46Ngw5ymiwgDmIzJkycLVYbs8m8IzJ5YOdruxk5CDCcPEGJceUgmOgYkjWv/BITXqVar+PsNJCsgp3FNHroDu/VMXoNbHOBNkzKAlbjAJdB7hToHzn8Cagk+wV+Bz6180Y14lmlAy/xs/5SDq55lMpNK4PyZwUBo= 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=HhTnm4SQ; arc=none smtp.client-ip=91.218.175.181 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="HhTnm4SQ" 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=1765443211; 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=wGL7AIJxmq201kkii3CXEVTm6gVDaQiDrS4KCLR0obs=; b=HhTnm4SQPrHpqnArhhmkiVdZ/XJSdy0J8d/zjaxhmoHitTOax5ViYpczSkiRCLzjfH1QHF 8xxnsWTS8Dqc+wvYD9piDhXbj8OiuXAUinLkTQdDTb/A++FtpDdkXYNLBUQHERjsAdNFyA aSf4MpLfDGpQHxZd+ZWv4ZmHJgfaNIk= From: Thorsten Blum To: Herbert Xu , "David S. Miller" Cc: Thorsten Blum , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] crypto: scompress - Use crypto_unregister_scomps in crypto_register_scomps Date: Thu, 11 Dec 2025 09:52:51 +0100 Message-ID: <20251211085251.799114-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 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 --- Changes in v2: - Leave crypto_unregister_scomps() as is (Herbert) - Link to v1: https://lore.kernel.org/lkml/20251210132548.569689-2-thorsten= .blum@linux.dev/ --- crypto/scompress.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/crypto/scompress.c b/crypto/scompress.c index 1a7ed8ae65b0..8d70c5ec6f8b 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c @@ -383,17 +383,13 @@ int crypto_register_scomps(struct scomp_alg *algs, in= t count) =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 --=20 Thorsten Blum GPG: 1D60 735E 8AEF 3BE4 73B6 9D84 7336 78FD 8DFE EAD4