Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp510335rdb; Mon, 15 Jan 2024 04:51:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IGhTb0ugnsDJYnti9oTPhMlVFO/yGhurJUxMDmbfXFkbezzfIh6YzuI5HymRlknJswbgHSp X-Received: by 2002:a17:902:d4c7:b0:1d4:4a0e:72a with SMTP id o7-20020a170902d4c700b001d44a0e072amr3096491plg.93.1705323111046; Mon, 15 Jan 2024 04:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705323111; cv=none; d=google.com; s=arc-20160816; b=EkRbCCtS/znpi+mG9X2ZZuv6Z5QwwbdK129QqrlWaqK0MqocWY/OAuWBjDYPNEgPYM IF8OpsktgZsdBqhyLAi2R8ISySrZEgA0WYory5THfp2BlqVTLg4OqfB+2Gt2zFk2Nnar TdiYftkTzB7D1OYm3eMgYmNJFZ8emLOjxsRuSRw2jqtv79Xwm+J8OMBvHWecrp6jzvqq Bn3c5oKfHmXxfLacV5pC5X9kR6dujYxpKa/WekWdsNbT2c2LX8LRRwcLKyu80eGwps/E LPWQjLX/B7rXeV52MwGnfEKaAVERMoo7+zjFFTtSFJLoHj7LXds3/rK0Ac18jKMv/BrC Cbig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=PX4w1eO8SQ4miExZH1g1NHHO884JSkp7W4e0LRAChEM=; fh=bIDVOSOENHw95gGnGFPxgGpS02aVkJeQL8+ZS22riqU=; b=aHYlx+Ci1abe8ToX8cSiSUfZzcQe5YKbJMg1NA8+fPpI1k6H5tVutVml1xGfr28hIx xnuRvILl/i1/WcWKXU9ebKuGj4xze+uuXx24eanBJk64QGSHppQnbtlq5YDTFH7RSal4 2g7epfHEWFHAwJ8+9esvpNoAL5jhS8aVevdpp7ZqzY5qTBtHVX3eF3/PeljdEDBw+k/U svR7qVxuxOFoQReMPeGJz63nTclUIoE5/Hf7G8z21sJK81alnGRu04m67axR2jD3Q7IW MMLwzj+BGGmBl+7/mHY4PSHh7cXyR0lpcRReXQB2TGblk99PRp86vh3VMZUtZ0tlPmg1 AjVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25973-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h6-20020a170902b94600b001d5d733d9c1si538012pls.47.2024.01.15.04.51.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 04:51:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-25973-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25973-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B12C82820EC for ; Mon, 15 Jan 2024 12:51:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8EDEB156E4; Mon, 15 Jan 2024 12:51:45 +0000 (UTC) Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63B011841 for ; Mon, 15 Jan 2024 12:51:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=grimberg.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-55760f84177so1736677a12.0 for ; Mon, 15 Jan 2024 04:51:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705323101; x=1705927901; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PX4w1eO8SQ4miExZH1g1NHHO884JSkp7W4e0LRAChEM=; b=lCa5RhvMh3UW+MLSmWQPxxddXmP76PLXY3BS7FCqKEqMihciURxQUAgzF4BEKgJjGB Qt9x3YRNFKutT7RgJxwiiVGEYwitPi33hTXbgXMZA2bFm/zseLe13iGMCCvv4YnCNKPr ffzXfpX/WIMyU45y2323o75hfD0n/8879poftppq5rINxIn0fJvfjIQIxa4H6tKaAfCe IdbeHOL1awPaF1uc4u0wc9Q94O34mMDoZB73rUxh/F339m1S6useoI6+joZdjlQ/oFBd xerxkka6QL0+lBk6tLH8r1XnI48I9z/8T7tSTzP80uGRVB0LLhJM2zJPOwCXkGejNh1w 4m+A== X-Gm-Message-State: AOJu0YwkClcZsGILdPvrC4z8PuGC9CtCOZwTALOfv9omdHQR9dWPui6E lu49H3QAB3dDyFL2zgXhxFM= X-Received: by 2002:aa7:da4a:0:b0:558:f40b:4581 with SMTP id w10-20020aa7da4a000000b00558f40b4581mr4126744eds.1.1705323101613; Mon, 15 Jan 2024 04:51:41 -0800 (PST) Received: from [192.168.64.172] (bzq-219-42-90.isdn.bezeqint.net. [62.219.42.90]) by smtp.gmail.com with ESMTPSA id j7-20020aa7ca47000000b00556ee10cfe3sm5395358edt.92.2024.01.15.04.51.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Jan 2024 04:51:41 -0800 (PST) Message-ID: <4ad9d0a8-00b6-4970-9127-ccbe1d2f26bf@grimberg.me> Date: Mon, 15 Jan 2024 14:51:39 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] nvme/auth: optimize code redundancy and provide code quality Content-Language: en-US To: mengfanhui , kbusch@kernel.org, axboe@kernel.dk Cc: linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org References: <20240115065231.12733-1-mengfanhui@kylinos.cn> From: Sagi Grimberg In-Reply-To: <20240115065231.12733-1-mengfanhui@kylinos.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit > Improve code quality. Reduce code redundancy. Why does this improve code quality? Why does this reduce code redundancy? It's just a different style, seems like a useless change to me. > > Signed-off-by: mengfanhui > --- > drivers/nvme/common/auth.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c > index a23ab5c968b9..4f9d06afdc38 100644 > --- a/drivers/nvme/common/auth.c > +++ b/drivers/nvme/common/auth.c > @@ -250,9 +250,7 @@ struct nvme_dhchap_key *nvme_auth_transform_key( > if (key->hash == 0) { > key_len = nvme_auth_key_struct_size(key->len); > transformed_key = kmemdup(key, key_len, GFP_KERNEL); > - if (!transformed_key) > - return ERR_PTR(-ENOMEM); > - return transformed_key; > + return transformed_key ? transformed_key : ERR_PTR(-ENOMEM); > } > hmac_name = nvme_auth_hmac_name(key->hash); > if (!hmac_name) { > > base-commit: c29901006179c4c87f9335771e50814ec5707239