diff --git a/drivers/scsi/cxlflash/superpipe.c b/drivers/scsi/cxlflash/superpipe.c index c91fe6fe8d08..9636970d9611 100644 --- a/drivers/scsi/cxlflash/superpipe.c +++ b/drivers/scsi/cxlflash/superpipe.c @@ -912,7 +912,8 @@ static int _cxlflash_disk_detach(struct scsi_device *sdev, * Release the context reference and the sdev reference that * bound this LUN to the context. */ - put_ctx = !kref_put(&ctxi->kref, remove_context); + if (kref_put(&ctxi->kref, remove_context)) + put_ctx = false; scsi_device_put(sdev); out: if (put_ctx)