summaryrefslogtreecommitdiffstats
path: root/drivers/ptp/ptp_clock.c
diff options
context:
space:
mode:
authorRasmus Villemoes <linux@rasmusvillemoes.dk>2018-10-26 23:22:59 +0200
committerDavid S. Miller <davem@davemloft.net>2018-10-29 03:20:06 +0100
commit822c5f7341366bef761e5e49f05bb8b1b0afccee (patch)
tree89d222508b83b263a0d481bcc715124882af1b31 /drivers/ptp/ptp_clock.c
parentnet: bridge: remove ipv6 zero address check in mcast queries (diff)
downloadlinux-822c5f7341366bef761e5e49f05bb8b1b0afccee.tar.xz
linux-822c5f7341366bef761e5e49f05bb8b1b0afccee.zip
ptp: drop redundant kasprintf() to create worker name
Building with -Wformat-nonliteral, gcc complains drivers/ptp/ptp_clock.c: In function ‘ptp_clock_register’: drivers/ptp/ptp_clock.c:239:26: warning: format not a string literal and no format arguments [-Wformat-nonliteral] worker_name : info->name); kthread_create_worker takes fmt+varargs to set the name of the worker, and that happens with a vsnprintf() to a stack buffer (that is then copied into task_comm). So there's no reason not to just pass "ptp%d", ptp->index to kthread_create_worker() and avoid the intermediate worker_name variable. Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Acked-by: Richard Cochran <richardcochran@gmail.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/ptp/ptp_clock.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 7eacc1c4b3b1..5419a89d300e 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -232,12 +232,8 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
init_waitqueue_head(&ptp->tsev_wq);
if (ptp->info->do_aux_work) {
- char *worker_name = kasprintf(GFP_KERNEL, "ptp%d", ptp->index);
-
kthread_init_delayed_work(&ptp->aux_work, ptp_aux_kworker);
- ptp->kworker = kthread_create_worker(0, worker_name ?
- worker_name : info->name);
- kfree(worker_name);
+ ptp->kworker = kthread_create_worker(0, "ptp%d", ptp->index);
if (IS_ERR(ptp->kworker)) {
err = PTR_ERR(ptp->kworker);
pr_err("failed to create ptp aux_worker %d\n", err);