diff mbox series

[-net] ptp: free 'vclock_index' in ptp_clock_release()

Message ID 20211021091353.457508-1-yangyingliang@huawei.com (mailing list archive)
State Accepted
Commit b6b19a71c8bbde2abaa99ba29e6c76ddc84984f8
Delegated to: Netdev Maintainers
Headers show
Series [-net] ptp: free 'vclock_index' in ptp_clock_release() | expand

Checks

Context Check Description
netdev/cover_letter success Single patches do not need cover letters
netdev/fixes_present fail Series targets non-next tree, but doesn't contain any Fixes tags
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers success CCed 2 of 2 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success No Fixes tag
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 23 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success No static functions without inline keyword in header files

Commit Message

Yang Yingliang Oct. 21, 2021, 9:13 a.m. UTC
'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: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/ptp/ptp_clock.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Oct. 21, 2021, noon UTC | #1
Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Thu, 21 Oct 2021 17:13:53 +0800 you wrote:
> '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: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/ptp/ptp_clock.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Here is the summary with links:
  - [-net] ptp: free 'vclock_index' in ptp_clock_release()
    https://git.kernel.org/netdev/net/c/b6b19a71c8bb

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 7fd02aabd79a..f9b2d66b0443 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -170,6 +170,7 @@  static void ptp_clock_release(struct device *dev)
 	struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev);
 
 	ptp_cleanup_pin_groups(ptp);
+	kfree(ptp->vclock_index);
 	mutex_destroy(&ptp->tsevq_mux);
 	mutex_destroy(&ptp->pincfg_mux);
 	mutex_destroy(&ptp->n_vclocks_mux);
@@ -286,8 +287,6 @@  struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
 	        if (ptp->pps_source)
 	                pps_unregister_source(ptp->pps_source);
 
-		kfree(ptp->vclock_index);
-
 		if (ptp->kworker)
 	                kthread_destroy_worker(ptp->kworker);
 
@@ -328,8 +327,6 @@  int ptp_clock_unregister(struct ptp_clock *ptp)
 	ptp->defunct = 1;
 	wake_up_interruptible(&ptp->tsev_wq);
 
-	kfree(ptp->vclock_index);
-
 	if (ptp->kworker) {
 		kthread_cancel_delayed_work_sync(&ptp->aux_work);
 		kthread_destroy_worker(ptp->kworker);