]> git.itanic.dy.fi Git - linux-stable/commitdiff
cxl/pci: Remove unnecessary device reference management in sanitize work
authorDan Williams <dan.j.williams@intel.com>
Fri, 29 Sep 2023 21:44:46 +0000 (14:44 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 29 Sep 2023 21:44:46 +0000 (14:44 -0700)
Given that any particular put_device() could be the final put of the
device, the fact that there are usages of cxlds->dev after
put_device(cxlds->dev) is a red flag. Drop the reference counting since
the device is pinned by being registered and will not be unregistered
without triggering the driver + workqueue to shutdown.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/pci.c

index 44a21ab7add51b70d17c645434934af347a93e58..aa1b3dd9e64c4f4f3be9891fb1f9ba04246715ac 100644 (file)
@@ -152,8 +152,6 @@ static void cxl_mbox_sanitize_work(struct work_struct *work)
        mutex_lock(&mds->mbox_mutex);
        if (cxl_mbox_background_complete(cxlds)) {
                mds->security.poll_tmo_secs = 0;
-               put_device(cxlds->dev);
-
                if (mds->security.sanitize_node)
                        sysfs_notify_dirent(mds->security.sanitize_node);
 
@@ -296,9 +294,6 @@ static int __cxl_pci_mbox_send_cmd(struct cxl_memdev_state *mds,
                 */
                if (mbox_cmd->opcode == CXL_MBOX_OP_SANITIZE) {
                        if (mds->security.poll) {
-                               /* hold the device throughout */
-                               get_device(cxlds->dev);
-
                                /* give first timeout a second */
                                timeout = 1;
                                mds->security.poll_tmo_secs = timeout;