Commit b6b19a71 authored by Yang Yingliang's avatar Yang Yingliang Committed by David S. Miller

ptp: free 'vclock_index' in ptp_clock_release()

'vclock_index' is accessed from sysfs, it shouled be freed
in release function, so move it from ptp_clock_unregister()
to ptp_clock_release().
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bf6abf34
...@@ -170,6 +170,7 @@ static void ptp_clock_release(struct device *dev) ...@@ -170,6 +170,7 @@ static void ptp_clock_release(struct device *dev)
struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
ptp_cleanup_pin_groups(ptp); ptp_cleanup_pin_groups(ptp);
kfree(ptp->vclock_index);
mutex_destroy(&ptp->tsevq_mux); mutex_destroy(&ptp->tsevq_mux);
mutex_destroy(&ptp->pincfg_mux); mutex_destroy(&ptp->pincfg_mux);
mutex_destroy(&ptp->n_vclocks_mux); mutex_destroy(&ptp->n_vclocks_mux);
...@@ -286,8 +287,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, ...@@ -286,8 +287,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
if (ptp->pps_source) if (ptp->pps_source)
pps_unregister_source(ptp->pps_source); pps_unregister_source(ptp->pps_source);
kfree(ptp->vclock_index);
if (ptp->kworker) if (ptp->kworker)
kthread_destroy_worker(ptp->kworker); kthread_destroy_worker(ptp->kworker);
...@@ -328,8 +327,6 @@ int ptp_clock_unregister(struct ptp_clock *ptp) ...@@ -328,8 +327,6 @@ int ptp_clock_unregister(struct ptp_clock *ptp)
ptp->defunct = 1; ptp->defunct = 1;
wake_up_interruptible(&ptp->tsev_wq); wake_up_interruptible(&ptp->tsev_wq);
kfree(ptp->vclock_index);
if (ptp->kworker) { if (ptp->kworker) {
kthread_cancel_delayed_work_sync(&ptp->aux_work); kthread_cancel_delayed_work_sync(&ptp->aux_work);
kthread_destroy_worker(ptp->kworker); kthread_destroy_worker(ptp->kworker);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment