Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp343810pxu; Wed, 25 Nov 2020 04:50:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZTWWEYvVTlhox6AEO/wHp/Llk6x6JiQWgmpYQdVY5PCOnqnGiaVIFhXxqz5YK9KcBX6jh X-Received: by 2002:a17:906:9816:: with SMTP id lm22mr2938412ejb.313.1606308652681; Wed, 25 Nov 2020 04:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606308652; cv=none; d=google.com; s=arc-20160816; b=p9LMrNjsaljidvzMlGCpk4UOB4kQwuxGG47wTQi9oSYRIfq2Sus/3XRUHC6vAKLDYp fhi+N5H5cUuJ55nGZo16JgvtncLcNMlhgwDqINzQsqHvnun/Prp1op8YXDXHA+VPK1mt cfzrEu0G7KmpN+OViKqS5GZX03vvHjihVFQDrTNPApSn79/bisQsiN1umsnRzER9GCi9 dFViDT8XbCjm9Mwre0Dukz5ty5QjZjqdDs0a0LuI7IkoCy6k+VwELAyAuHAQxzM183yj 3pKltAx/jIJEwMoWqShgTiExVmZFUH1r2HDd7lAAMsBuque7ir7gvoHWEcxLEzR2MzQ9 h4xQ== 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=hINh9EfkMImqBwm1ImJqrMFyWsY1edZuuy5lm7qLBFM=; b=CIysA7sNX+IOV7WwGGB1cTqC4gJ7V54N/JLG4t00KT4U29d47vF/JtodmCOTrsEYJI qQhqYQQ8HKnqA+FH/DCLacGU4MI2kM+cnqv2BVXcMyadq+GEFnN5mxzob0yjYetsokZ/ DL419oE7qkxEPFjhhy3uckmOz8Ajx3JowUIMwovNmkS1w7A9Y5fl5/opA6AoVtkjtkkq 4BkTeA70UriMNRFgPYE91oyR8vl9RQMDqGwaKImr/3VEQBQTW361gHiVSOvpVXg6H09o l5S0BHr8fDmuUpP1ClkBuiWQFzUJFyLX5bTbu5nf2EX5BHzHa7YSFkCfYkK+dNI892YQ ysUw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v21si1199851ejh.106.2020.11.25.04.50.30; Wed, 25 Nov 2020 04:50:52 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728902AbgKYMrH (ORCPT + 99 others); Wed, 25 Nov 2020 07:47:07 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:7987 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbgKYMrH (ORCPT ); Wed, 25 Nov 2020 07:47:07 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4Ch0yC15Z8zhhMs; Wed, 25 Nov 2020 20:46:43 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Nov 2020 20:46:51 +0800 From: Wang ShaoBo To: CC: , , , , , , Subject: [PATCH] block/rnbd: server: Fix error return code in rnbd_srv_create_dev_sysfs() Date: Wed, 25 Nov 2020 20:46:47 +0800 Message-ID: <20201125124647.30327-1-bobo.shaobowang@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix to return -ENOMEM error code from the error handling case where kobject_create_and_add() failed instead of 0 in rnbd_srv_create_dev_sysfs(), as done elsewhere in this function. Signed-off-by: Wang ShaoBo --- drivers/block/rnbd/rnbd-srv-sysfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv-sysfs.c b/drivers/block/rnbd/rnbd-srv-sysfs.c index 106775c074d1..5ba1a31ad626 100644 --- a/drivers/block/rnbd/rnbd-srv-sysfs.c +++ b/drivers/block/rnbd/rnbd-srv-sysfs.c @@ -52,8 +52,10 @@ int rnbd_srv_create_dev_sysfs(struct rnbd_srv_dev *dev, dev->dev_sessions_kobj = kobject_create_and_add("sessions", &dev->dev_kobj); - if (!dev->dev_sessions_kobj) + if (!dev->dev_sessions_kobj) { + ret = -ENOMEM; goto put_dev_kobj; + } bdev_kobj = &disk_to_dev(bdev->bd_disk)->kobj; ret = sysfs_create_link(&dev->dev_kobj, bdev_kobj, "block_dev"); -- 2.17.1