diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 282cd7d24077..27c1ef493617 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -585,7 +585,5 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, free_event: kfree(event); exit: - if (result < 0) - ptp_release(pccontext); return result; } diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 282cd7d24077..bc99d505eeac 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c @@ -121,6 +121,7 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode) spin_lock_init(&queue->lock); list_add_tail(&queue->qlist, &ptp->tsevqs); pccontext->private_clkdata = queue; + printk("%p, %p, %s\n", queue, &queue->qlist, __func__); /* Debugfs contents */ sprintf(debugfsname, "0x%p", queue); @@ -140,12 +141,14 @@ int ptp_release(struct posix_clock_context *pccontext) struct timestamp_event_queue *queue = pccontext->private_clkdata; unsigned long flags; - if (queue) { + pccontext->private_clkdata = NULL; + if (!IS_ERR_OR_NULL(queue)) { debugfs_remove(queue->debugfs_instance); - pccontext->private_clkdata = NULL; + printk("%p, %p, %s\n", queue, &queue->qlist, __func__); spin_lock_irqsave(&queue->lock, flags); list_del(&queue->qlist); spin_unlock_irqrestore(&queue->lock, flags); + printk("deled, %p, %p, %s\n", queue, &queue->qlist, __func__); bitmap_free(queue->mask); kfree(queue); } diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index 3d1b0a97301c..fe11e3fc1592 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -181,6 +181,7 @@ static void ptp_clock_release(struct device *dev) /* Delete first entry */ tsevq = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist); + printk("%p, %p, %s\n", tsevq, &tsevq->qlist, __func__); spin_lock_irqsave(&tsevq->lock, flags); list_del(&tsevq->qlist); spin_unlock_irqrestore(&tsevq->lock, flags);