Skip to content

Commit

Permalink
kthread: add __printf attributes
Browse files Browse the repository at this point in the history
When commit fbae2d4 ("kthread: add kthread_create_worker*()")
introduced some kthread_create_...() functions which were taking
printf-like parametter, it introduced __printf attributes to some
functions (e.g.  kthread_create_worker()).  Nevertheless some new
functions were forgotten (they have been detected thanks to
-Wmissing-format-attribute warning flag).

Add the missing __printf attributes to the newly-introduced functions in
order to detect formatting issues at build-time with -Wformat flag.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Nicolas Iooss <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
fishilico authored and torvalds committed Dec 13, 2016
1 parent df5f0f0 commit c0b942a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/linux/kthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ __printf(2, 3)
struct kthread_worker *
kthread_create_worker(unsigned int flags, const char namefmt[], ...);

struct kthread_worker *
__printf(3, 4) struct kthread_worker *
kthread_create_worker_on_cpu(int cpu, unsigned int flags,
const char namefmt[], ...);

Expand Down
5 changes: 3 additions & 2 deletions kernel/kthread.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,8 @@ static void create_kthread(struct kthread_create_info *create)
}
}

static struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
static __printf(4, 0)
struct task_struct *__kthread_create_on_node(int (*threadfn)(void *data),
void *data, int node,
const char namefmt[],
va_list args)
Expand Down Expand Up @@ -635,7 +636,7 @@ int kthread_worker_fn(void *worker_ptr)
}
EXPORT_SYMBOL_GPL(kthread_worker_fn);

static struct kthread_worker *
static __printf(3, 0) struct kthread_worker *
__kthread_create_worker(int cpu, unsigned int flags,
const char namefmt[], va_list args)
{
Expand Down

0 comments on commit c0b942a

Please sign in to comment.