Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3474060pxu; Mon, 30 Nov 2020 04:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJx1BkW0JOPiU7ZqqVuNhCYkZ8E082k8SZvvecg5iL5WAKQNSC24m2puYz8Wq2bJ5NcjAvBt X-Received: by 2002:a17:906:86c2:: with SMTP id j2mr1616074ejy.451.1606738040213; Mon, 30 Nov 2020 04:07:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606738040; cv=none; d=google.com; s=arc-20160816; b=oCKlHkgKYp1mBlMi5ph95s96Wf38AbyUzToFvRPEHsSBh1BUgxrgNXF+SXVj+hOLPT jhwFJYd65HV1yJmrY7kObyrA0eWR2t7Qobdiwb7mCEAgAs5fCW64sf3gBDejlqmx4ALH hTXioyvE0x0uxQZ3PAqe6e1JBV56A2XDnWrdFby6X6QWiyM6TZtzV4Pph1JBBt6AehRz f4ae6l86gMpuCD9sN+NzOLTVVvvz8fqPX/XfZHX4262xbasCj9viZ9ICC6+ZaIhdo/8z 489o4jV5Bnx7ZvS76F8FvX+nKJ/LC0n3Q2nF/joYWf9FsrcTucIy894wzRSCYDtAIvU2 X74w== 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=SRY6+5u7G/QiHqIJlh7CrsdDxNn0QnyI2IfBtQx3y4nR93hp/y0FwFhJJiDr5cRDz/ WCiBmkVLCzjUGV9W3aT8PigkRNApiKLkNb8zR6cxC9m+6vHMJ6ns2wj36BbB+Xf7Ufl9 1/VENG4OpXXBLIGUm1QFU++oImsl7lr2YxDu19g+OEbSnj9+6G9rPvlGRnZB/UPdqksf 5DjzG2mhts2s7dEaKHDHtzi9eluf6PEMJktB9KTt7+XoOxHpJE5FGdO85KHb/cD6ln8v xntSlTRZP9wVTixF7vBVM3vj62nmmyCbXPemzUXYK3n4XCskyKhFrlXcBcMlwDHO8vZ0 zirA== 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 3si11164683edv.202.2020.11.30.04.06.56; Mon, 30 Nov 2020 04:07:20 -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 S1729267AbgK3MEj (ORCPT + 99 others); Mon, 30 Nov 2020 07:04:39 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:8218 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726810AbgK3MEj (ORCPT ); Mon, 30 Nov 2020 07:04:39 -0500 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cl3lt6HX9zkjgZ; Mon, 30 Nov 2020 20:03:22 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Nov 2020 20:03:47 +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:49 +0800 Message-ID: <20201130121149.194131-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