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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EE767C001DB for ; Tue, 8 Aug 2023 16:54:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/c4Mc7AxB5ttrF5/AeeKvELhR9aqszv+Mhzl5cJJ8NU=; b=NCr1C+VNtqb2eC3P0KReOg/X7h Gxe32awUb/V9ovgbik/F9HG05/uZhvSbXR6IfcX9TcBkV6/R7KbmQxCO5x8NxJDOnhCixnfskwHKu DAwzhNjK7U6ajA+gvGu6ESPB2lOAtVcAGEKVOxcIOfF2Bk9WorFGl67iQJ2gcT+DBR8tJVME0yAHh UYJ/a44Nv425d0NrocWDUZ3Wf3RChX9VIH45AicMI0ko3MMJ7hbrm14OcLx88Ue+yuYFkKb6JGQjs VNDrcyB9kqcQ2Hhqle1HpSYBURWgvjwBuNu67HFv5mINRUIyMqNQbXkZ49gqAkFGA4d+qxqCFgnYG 88+yrrIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTPyU-003282-1u; Tue, 08 Aug 2023 16:54:26 +0000 Received: from smtp-out1.suse.de ([2001:67c:2178:6::1c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTPyL-0031zA-1G for linux-nvme@lists.infradead.org; Tue, 08 Aug 2023 16:54:19 +0000 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 5B47C22475; Tue, 8 Aug 2023 16:54:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691513648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/c4Mc7AxB5ttrF5/AeeKvELhR9aqszv+Mhzl5cJJ8NU=; b=XiTaeLARQU0FikHdBlee09bLzxX0U87nezeRgYzvmP2D3lXDj/Rctsty1H/GCpN5GQRVBS CZ1P8sCWjvitvCx4cA2538rj1CTgeU5Cl/O1u39a7nyicWkWPnhA3pgnhotPJCoyg6iLZN +/8HJlWGILhIZkufpfaJtzUDZKBF5fg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691513648; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/c4Mc7AxB5ttrF5/AeeKvELhR9aqszv+Mhzl5cJJ8NU=; b=837jvuSSZEqMBcKHbkdM/5llx1R5VLpmZz7hPuHLbW14BvuR/AUgnZ3q28LxSeLrLqsQZv Rm4NT67gOyozObCw== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 4F79D2C15C; Tue, 8 Aug 2023 16:54:08 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 4BA9851CACFD; Tue, 8 Aug 2023 18:54:08 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, Hannes Reinecke Subject: [PATCH 12/16] nvmet-tcp: make nvmet_tcp_alloc_queue() a void function Date: Tue, 8 Aug 2023 18:53:50 +0200 Message-Id: <20230808165354.123499-13-hare@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230808165354.123499-1-hare@suse.de> References: <20230808165354.123499-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230808_095417_581069_770ED4A5 X-CRM114-Status: GOOD ( 11.96 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org The return value from nvmet_tcp_alloc_queue() are just used to figure out if sock_release() need to be called. So this patch moves sock_release() into nvmet_tcp_alloc_queue() and make it a void function. Signed-off-by: Hannes Reinecke --- drivers/nvme/target/tcp.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 868aa4de2e4c..019b2598d8d1 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1621,7 +1621,7 @@ static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue) return ret; } -static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, +static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, struct socket *newsock) { struct nvmet_tcp_queue *queue; @@ -1629,7 +1629,7 @@ static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, queue = kzalloc(sizeof(*queue), GFP_KERNEL); if (!queue) - return -ENOMEM; + goto out_release; INIT_WORK(&queue->release_work, nvmet_tcp_release_queue_work); INIT_WORK(&queue->io_work, nvmet_tcp_io_work); @@ -1666,7 +1666,7 @@ static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, if (ret) goto out_destroy_sq; - return 0; + return; out_destroy_sq: mutex_lock(&nvmet_tcp_queue_mutex); list_del_init(&queue->queue_list); @@ -1678,7 +1678,9 @@ static int nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port, ida_free(&nvmet_tcp_queue_ida, queue->idx); out_free_queue: kfree(queue); - return ret; +out_release: + pr_err("failed to allocate queue\n"); + sock_release(newsock); } static void nvmet_tcp_accept_work(struct work_struct *w) @@ -1695,11 +1697,7 @@ static void nvmet_tcp_accept_work(struct work_struct *w) pr_warn("failed to accept err=%d\n", ret); return; } - ret = nvmet_tcp_alloc_queue(port, newsock); - if (ret) { - pr_err("failed to allocate queue\n"); - sock_release(newsock); - } + nvmet_tcp_alloc_queue(port, newsock); } } -- 2.35.3