Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1229290pxb; Wed, 3 Nov 2021 21:20:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweOvHZ2dkKnMqeVe60/4o4Y+gP3ZXe9sgxP77aCkOUlI7tUeRjldBiEgfS50Gy08wH/1S8 X-Received: by 2002:a05:6402:2682:: with SMTP id w2mr66911645edd.185.1635999617290; Wed, 03 Nov 2021 21:20:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635999617; cv=none; d=google.com; s=arc-20160816; b=aMfic9GCs4HZsZSDy58GOLzs6foNY07DQIY8mnJ3GEd7x78VELul1Aa94W42z0TWoZ CgNRi9Xf7mkgf2lw69T8l750pkwBWWx4g+5DKceFpUEqnvCZb1TdCckih2lej2o6eKkq GN4wiKppJLIgRnvmPq6YZxCJ4w2K95fhJZYp2iobKYPYGylW34Lu8djstUthy224aeQD 8/hflkGagrw7rl4UsM7xmJlM0/d9s2NRdeRnS95ggbOLOGo9PPpri4zvv7PGEvfM9e7C uHqSh0d8Fo1DrL6aW+tCSyTY2A0xKMWZH4S561zoy5z+JSvXsVNXGG5DgeN8hU8nmD52 Rq3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=5p+NqNSbztCKtcmRjjmC0W7WEtTWuHbsu7DjWxVONbQ=; b=MyqJ1pkA0Iv3SP8fS892e/dKCZRBEtaiXDZVbqP5MOowEqMe0TH8drLSv8MWe1mGdt dmFkNM28jVCuwEFP/3eC/RArnkuijJIQxm8plGemPQAHvC1zlooRYF8cDk/9V32hQZIh ZTjhgBftdmf0x/IlDRCkpMqR+DmDPW3/IkBx4wwSj1KuntWoCTcp1UEEz8c90GjENzwW uGOLZTJOnZzFQ+C3CnA/8lSYFvKVecdSIkFAEl4VcieX9gCo3RLbko4Z7UZEUlI9+k9/ KEGHbpogFPR59L7Ryj7O96uJTJph/i124/FEgpX+P8EOfogz5PlwMkMxlWNbkRQuAjbU Nmww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si5433794ejd.175.2021.11.03.21.19.53; Wed, 03 Nov 2021 21:20:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbhKDEJI (ORCPT + 99 others); Thu, 4 Nov 2021 00:09:08 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:14713 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbhKDEJH (ORCPT ); Thu, 4 Nov 2021 00:09:07 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Hl94h1yzqzZckp; Thu, 4 Nov 2021 12:04:20 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 4 Nov 2021 12:06:16 +0800 Received: from huawei.com (10.175.124.27) by dggpeml500019.china.huawei.com (7.185.36.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Thu, 4 Nov 2021 12:06:16 +0800 From: Wu Bo To: , CC: , , , , Subject: [PATCH RESEND] nbd: code clean for nbd_genl_status() Date: Thu, 4 Nov 2021 12:38:23 +0800 Message-ID: <1636000703-13217-1-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpeml500019.china.huawei.com (7.185.36.137) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A simple code clean for nbd_genl_status() Signed-off-by: Wu Bo --- drivers/block/nbd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index b47b2a8..175ea97 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -2375,7 +2375,6 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) reply_head = genlmsg_put_reply(reply, info, &nbd_genl_family, 0, NBD_CMD_STATUS); if (!reply_head) { - nlmsg_free(reply); goto out; } @@ -2383,7 +2382,6 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) if (index == -1) { ret = idr_for_each(&nbd_index_idr, &status_cb, reply); if (ret) { - nlmsg_free(reply); goto out; } } else { @@ -2392,7 +2390,6 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) if (nbd) { ret = populate_nbd_status(nbd, reply); if (ret) { - nlmsg_free(reply); goto out; } } @@ -2401,6 +2398,8 @@ static int nbd_genl_status(struct sk_buff *skb, struct genl_info *info) genlmsg_end(reply, reply_head); ret = genlmsg_reply(reply, info); out: + if (reply) + nlmsg_free(reply); mutex_unlock(&nbd_index_mutex); return ret; } -- 1.8.3.1