Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3474415pxu; Mon, 30 Nov 2020 04:07:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxH+LKQfczvofyszdfGJ+SqDajtSC/1KsyxtLlM8z4oCa3nhjEY09rDV1NX3lGhogtWmskv X-Received: by 2002:ac2:5281:: with SMTP id q1mr9040374lfm.249.1606738064724; Mon, 30 Nov 2020 04:07:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606738064; cv=none; d=google.com; s=arc-20160816; b=d23PTNS6RQejmyaIdzZwRw3euSbMZ2KWT7KYRbsmYxbkacXuZtrXfTTwKYu0/S9ZCS Bp8DzQa3pV/XcgcoHlLMMuYlqYrYuIuXjoN3LQ7Y7B56Z9ER8V9tWOGlyE50WjGn1k0M +x6uKP/F510AR+mn+jv0YP1ro65rdU8aNEPPSY00ItMlqlad2PsvS3CQA8fYmOJp2Mop 5oG4xCxqUvBVvKdg7tHBDy3usBcvM8gefR+Zc5+q7jM2X0ZUJrTsDEYiwvt5eo8LuBt/ /TC0En9NkD9/FNnkFFdyTd82JKQAPiHE0Wvs1yy1Au2FIKP0kLaBxXR5E3RCjS1XBHun JkFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=7jB+WsU4Ywbd+IXXc8p8T6hMFboKzBiZ/p9EfY5fo54=; b=pWiu8h17WjqRzu/92oyD3GLqm9NZTX0Ya+dvNotSyXdYQlsq9O7FrHZ+iqQgZitpCC r6wpukeV8PNYvIShAmAfh4ESawJTnvyLHZri2W0lA/6m6AL5B9mZv33Bgv4tCAYrP0f8 VSkuXgRHQ241jc6ci8BJ3d3IpU+pYCXAVxO51ibie1KEdRT32TCi6iPwFm02koe8NiAt azcGljgDEoVnTWZROZXHQ3RDpPtHEo6/4uk82ErXpvetrXat9DRLb6uS0XD5nuKCTEU0 NMLe2qo1r2KWxV04qeZBcYRSkI+QiUZDqDEm/G4df9X28Fv1vFopxxtMijDCQm0KPiYi 7Bqw== 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 s21si9474138ejr.461.2020.11.30.04.07.22; Mon, 30 Nov 2020 04:07:44 -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 S1729284AbgK3MEn (ORCPT + 99 others); Mon, 30 Nov 2020 07:04:43 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9072 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727656AbgK3MEn (ORCPT ); Mon, 30 Nov 2020 07:04:43 -0500 Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Cl3m04d5RzLxqn; Mon, 30 Nov 2020 20:03:28 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS408-HUB.china.huawei.com (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Nov 2020 20:03:52 +0800 From: Qinglang Miao To: Steffen Maier , Benjamin Block , Heiko Carstens , Vasily Gorbik , Christian Borntraeger CC: , , "Qinglang Miao" Subject: [PATCH] scsi: zfcp: move the position of put_device Date: Mon, 30 Nov 2020 20:11:54 +0800 Message-ID: <20201130121154.194190-1-miaoqinglang@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Have the `put_device()` call after `device_unregister()` in both `zfcp_unit_remove()` and `zfcp_sysfs_port_remove_store()` to make it more natural, for put_device() ought to be the last time we touch the object in both functions. Suggested-by: Benjamin Block Signed-off-by: Qinglang Miao --- drivers/s390/scsi/zfcp_sysfs.c | 4 ++-- drivers/s390/scsi/zfcp_unit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/s390/scsi/zfcp_sysfs.c b/drivers/s390/scsi/zfcp_sysfs.c index 8d9662e8b..edfeed4ba 100644 --- a/drivers/s390/scsi/zfcp_sysfs.c +++ b/drivers/s390/scsi/zfcp_sysfs.c @@ -327,10 +327,10 @@ static ssize_t zfcp_sysfs_port_remove_store(struct device *dev, list_del(&port->list); write_unlock_irq(&adapter->port_list_lock); - put_device(&port->dev); - zfcp_erp_port_shutdown(port, 0, "syprs_1"); device_unregister(&port->dev); + + put_device(&port->dev); out: zfcp_ccw_adapter_put(adapter); return retval ? retval : (ssize_t) count; diff --git a/drivers/s390/scsi/zfcp_unit.c b/drivers/s390/scsi/zfcp_unit.c index e67bf7388..4ee355ae1 100644 --- a/drivers/s390/scsi/zfcp_unit.c +++ b/drivers/s390/scsi/zfcp_unit.c @@ -255,9 +255,9 @@ int zfcp_unit_remove(struct zfcp_port *port, u64 fcp_lun) scsi_device_put(sdev); } - put_device(&unit->dev); - device_unregister(&unit->dev); + put_device(&unit->dev); + return 0; } -- 2.23.0