From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22404C4167B for ; Tue, 28 Nov 2023 21:25:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234964AbjK1VYu (ORCPT ); Tue, 28 Nov 2023 16:24:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234936AbjK1VY2 (ORCPT ); Tue, 28 Nov 2023 16:24:28 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B33C249F5 for ; Tue, 28 Nov 2023 13:08:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB774C433B7; Tue, 28 Nov 2023 21:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701205735; bh=NmHZuShuIsfRro8+cNQGg6OPkZ1QnmfJ3yoB9WXUG2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4TV9RWb9Dzt5f0cBIVu/z7hcukyo8Rppa++4rEIcmp/WRzo3ZUuGilExAdcDJx5p hoj/SsNAfu9I+IvTkg4f2kVsW+BQ1NAQ6yKzabBZgTzHKzVjcq2JQWUnoptO9WlEun P7kXKdgpIEHcdsWtfs6YhGUejO5N1MpUXiloDAUQm+KL2inH2FrcgKhlGJeVExu1Tr jCpXaf3cDmfAEvIJpvzL+yivz0Mb6KqoWRQTzgz22nrRNCGD739jtUXowjRovrRtd+ MH2aBKhWgkkVV8GAfgyIW3KyP/LYYT/NmY7XSNEcgXt5wjUElyGHjQEPtipEyoth1G W+MFR9AXp6DYA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Coly Li , Jens Axboe , Sasha Levin , kent.overstreet@gmail.com, linux-bcache@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 07/15] bcache: add code comments for bch_btree_node_get() and __bch_btree_node_alloc() Date: Tue, 28 Nov 2023 16:08:28 -0500 Message-ID: <20231128210843.876493-7-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231128210843.876493-1-sashal@kernel.org> References: <20231128210843.876493-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 5.15.140 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Coly Li [ Upstream commit 31f5b956a197d4ec25c8a07cb3a2ab69d0c0b82f ] This patch adds code comments to bch_btree_node_get() and __bch_btree_node_alloc() that NULL pointer will not be returned and it is unnecessary to check NULL pointer by the callers of these routines. Signed-off-by: Coly Li Link: https://lore.kernel.org/r/20231120052503.6122-10-colyli@suse.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/md/bcache/btree.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c index 88097d1892ace..35bac23db856a 100644 --- a/drivers/md/bcache/btree.c +++ b/drivers/md/bcache/btree.c @@ -974,6 +974,9 @@ static struct btree *mca_alloc(struct cache_set *c, struct btree_op *op, * * The btree node will have either a read or a write lock held, depending on * level and op->lock. + * + * Note: Only error code or btree pointer will be returned, it is unncessary + * for callers to check NULL pointer. */ struct btree *bch_btree_node_get(struct cache_set *c, struct btree_op *op, struct bkey *k, int level, bool write, @@ -1085,6 +1088,10 @@ static void btree_node_free(struct btree *b) mutex_unlock(&b->c->bucket_lock); } +/* + * Only error code or btree pointer will be returned, it is unncessary for + * callers to check NULL pointer. + */ struct btree *__bch_btree_node_alloc(struct cache_set *c, struct btree_op *op, int level, bool wait, struct btree *parent) -- 2.42.0