Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1226032pxb; Wed, 3 Nov 2021 21:15:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXNQ+bq6d0UsmPxFlT9RdqhYIihS7qihXgpe09HyuwecMamjK4RPRL41xGoys+h6kePQoN X-Received: by 2002:a17:907:9803:: with SMTP id ji3mr57477390ejc.286.1635999320107; Wed, 03 Nov 2021 21:15:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635999320; cv=none; d=google.com; s=arc-20160816; b=RfeuZ6Afs1ue9An6k5wPaZ+zKsXlI7Z+DpfZX0mGnKZ2IMdwOnudQdfBRj3FkvQeZB y1inS/BoALezSz7DD+HNSQE9Am5EHC9kP+U/CWmvZMLaLXXoCLwYpb2epGAXcyyr3Uev 8aY+A3Y2BgtZa//DPrnlxTFe9EXUn36MwpkNZDaLSMgUfoG/y2/DHtyNJQOCGXXJ4uH6 Q6T+9HmFgzF/IlpuNNRTlDHX/ygEUlC/PfcPnpZIPj5FVfnbnekdzKExAs6697+C1VP/ apdQwq/4EykuFWpQvUxgTxaM1LTwv9e5paxGZU6aKr70SUIYQmScXoGIrX+rJvoKCFKA +4/g== 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=Hw0CoeQ6us4Vp9UBqSN23x7i8t74AGvvUMQom6o88bONJBdSrbJk6jRCbFrbxJjbjz 9EivtOHhiOhojw2UIMOlkRk1fuwNffk36yS93wsoL5DCyGTyKXNqcqmuHkVdeddJC2P7 c+aBsxWXZY1VC1h7eD8vs6gAlFyleycRutH5LR8jdHZl261s5Gq5ssP1FqS941EnWFs3 dJhCRrDO+Tz7OVQ+3q7kk/KlVY+HF2vR7UtNXOmXGBypIq76pz4u6+cCY5dpO1NviY/P wWZ2+PVq1/Imkl9WSSaGfiPJFm2L8ejCNo7aAnM18tsIsCaBLsYp4/46bZOsbVkjzaL3 lwJA== 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 h4si9319565ede.281.2021.11.03.21.14.56; Wed, 03 Nov 2021 21:15:20 -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 S229477AbhKDEFL (ORCPT + 99 others); Thu, 4 Nov 2021 00:05:11 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:25357 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230119AbhKDEFG (ORCPT ); Thu, 4 Nov 2021 00:05:06 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Hl8x04JDJzbhXG; Thu, 4 Nov 2021 11:57:40 +0800 (CST) Received: from dggpeml500019.china.huawei.com (7.185.36.137) by dggemv703-chm.china.huawei.com (10.3.19.46) 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:02:25 +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:02:25 +0800 From: Wu Bo To: , CC: , , , , Subject: [PATCH] nbd: code clean for kiocb_done() Date: Thu, 4 Nov 2021 12:34:32 +0800 Message-ID: <1636000472-3092-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: dggems703-chm.china.huawei.com (10.3.19.180) 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