All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Boqun Feng <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: boqun.feng@gmail.com, torvalds@linux-foundation.org,
	arnd@arndb.de, dan.j.williams@intel.com,
	linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	hpa@zytor.com, rjw@rjwysocki.net, lenb@kernel.org,
	peterz@infradead.org, mingo@kernel.org, npiggin@gmail.com,
	byungchul.park@lge.com, tglx@linutronix.de
Subject: [tip:locking/core] acpi/nfit: Fix COMPLETION_INITIALIZER_ONSTACK() abuse
Date: Tue, 29 Aug 2017 07:24:19 -0700	[thread overview]
Message-ID: <tip-1c322ac06d9af7ea259098ae5dc977855207d335@git.kernel.org> (raw)
In-Reply-To: <20170824142239.15178-1-boqun.feng@gmail.com>

Commit-ID:  1c322ac06d9af7ea259098ae5dc977855207d335
Gitweb:     http://git.kernel.org/tip/1c322ac06d9af7ea259098ae5dc977855207d335
Author:     Boqun Feng <boqun.feng@gmail.com>
AuthorDate: Thu, 24 Aug 2017 22:22:36 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 29 Aug 2017 15:14:38 +0200

acpi/nfit: Fix COMPLETION_INITIALIZER_ONSTACK() abuse

COMPLETION_INITIALIZER_ONSTACK() is supposed to be used as an initializer,
in other words, it should only be used in assignment expressions or
compound literals. So the usage in drivers/acpi/nfit/core.c:

	COMPLETION_INITIALIZER_ONSTACK(flush.cmp);

... is inappropriate.

Besides, this usage could also break the build for another fix that
reduces stack sizes caused by COMPLETION_INITIALIZER_ONSTACK(), because
that fix changes COMPLETION_INITIALIZER_ONSTACK() from rvalue to lvalue,
and usage as above will report the following error:

	drivers/acpi/nfit/core.c: In function 'acpi_nfit_flush_probe':
	include/linux/completion.h:77:3: error: value computed is not used [-Werror=unused-value]
	  (*({ init_completion(&work); &work; }))

This patch fixes this by replacing COMPLETION_INITIALIZER_ONSTACK()
with init_completion() in acpi_nfit_flush_probe(), which does the
same initialization without any other problems.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Byungchul Park <byungchul.park@lge.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: walken@google.com
Cc: willy@infradead.org
Link: http://lkml.kernel.org/r/20170824142239.15178-1-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/acpi/nfit/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
index 19182d0..1893e41 100644
--- a/drivers/acpi/nfit/core.c
+++ b/drivers/acpi/nfit/core.c
@@ -2884,7 +2884,7 @@ static int acpi_nfit_flush_probe(struct nvdimm_bus_descriptor *nd_desc)
 	 * need to be interruptible while waiting.
 	 */
 	INIT_WORK_ONSTACK(&flush.work, flush_probe);
-	COMPLETION_INITIALIZER_ONSTACK(flush.cmp);
+	init_completion(&flush.cmp);
 	queue_work(nfit_wq, &flush.work);
 	mutex_unlock(&acpi_desc->init_mutex);
 

  parent reply	other threads:[~2017-08-29 14:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 15:25 [PATCH 0/2] completion: Reduce stack usage caused by COMPLETION_INITIALIZER_ONSTACK() Boqun Feng
2017-08-23 15:25 ` Boqun Feng
2017-08-23 15:25 ` [PATCH 1/2] nfit: Use init_completion() in acpi_nfit_flush_probe() Boqun Feng
2017-08-23 15:25   ` Boqun Feng
2017-08-23 22:08   ` Dan Williams
2017-08-23 22:08     ` Dan Williams
2017-08-23 22:08     ` Dan Williams
2017-08-24 13:07   ` Thomas Gleixner
2017-08-24 13:07     ` Thomas Gleixner
2017-08-24 13:28     ` Boqun Feng
2017-08-24 13:46       ` Arnd Bergmann
2017-08-24 13:46         ` Arnd Bergmann
2017-08-24 13:46         ` Arnd Bergmann
     [not found]   ` <20170823152542.5150-2-boqun.feng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-24 14:22     ` [PATCH v2 1/2] nfit: Fix the abuse of COMPLETION_INITIALIZER_ONSTACK() Boqun Feng
2017-08-24 14:22       ` Boqun Feng
2017-08-24 14:22       ` Boqun Feng
2017-08-25  0:18       ` Boqun Feng
2017-08-25  0:36       ` Dan Williams
2017-08-25  0:36         ` Dan Williams
2017-08-25  0:36         ` Dan Williams
2017-08-29 14:24       ` tip-bot for Boqun Feng [this message]
2017-08-23 15:25 ` [PATCH 2/2] completion: Avoid unnecessary stack allocation for COMPLETION_INITIALIZER_ONSTACK() Boqun Feng
2017-08-23 15:25   ` Boqun Feng
2017-08-29 14:24   ` [tip:locking/core] sched/completion: " tip-bot for Boqun Feng
2017-08-23 15:33 ` [PATCH 0/2] completion: Reduce stack usage caused by COMPLETION_INITIALIZER_ONSTACK() Arnd Bergmann
2017-08-23 15:33   ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-1c322ac06d9af7ea259098ae5dc977855207d335@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=boqun.feng@gmail.com \
    --cc=byungchul.park@lge.com \
    --cc=dan.j.williams@intel.com \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.