Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579170 > unrolled thread

[PATCH 2/2] arch/x86: Fix sparse warning symbol not declared

Started by"Tobin C. Harding" <me@tobin.cc>
First post2017-02-12 07:50 +0100
Last post2017-02-12 12:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] arch/x86: Fix sparse warning symbol not declared "Tobin C. Harding" <me@tobin.cc> - 2017-02-12 07:50 +0100
    Re: [PATCH 2/2] arch/x86: Fix sparse warning symbol not declared Thomas Gleixner <tglx@linutronix.de> - 2017-02-12 12:10 +0100

#1579170 — [PATCH 2/2] arch/x86: Fix sparse warning symbol not declared

From"Tobin C. Harding" <me@tobin.cc>
Date2017-02-12 07:50 +0100
Subject[PATCH 2/2] arch/x86: Fix sparse warning symbol not declared
Message-ID<t9W8W-2TD-11@gated-at.bofh.it>
This patch adds function declaration in order to quiet sparse symbol
not declared warning.

Signed-off-by: Tobin C. Harding <me@tobin.cc>
---

Unsure why adding declaration quiets sparse. This may not be the
correct solution. Only testing done is building and booting kernel.
Since 'purgatory' is called from assembler and does not need forward
declaration the only advantage to this patch seems to be to save the
next newbie from investigating the sparse warning.

arch/x86/purgatory/purgatory.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/purgatory/purgatory.c b/arch/x86/purgatory/purgatory.c
index 2a2cbe5..129433c 100644
--- a/arch/x86/purgatory/purgatory.c
+++ b/arch/x86/purgatory/purgatory.c
@@ -18,6 +18,8 @@ struct sha_region {
 	unsigned long len;
 };
 
+void purgatory(void);
+
 static unsigned long backup_dest = 0;
 static unsigned long backup_src = 0;
 static unsigned long backup_sz = 0;
-- 
2.7.4

[toc] | [next] | [standalone]


#1579195

FromThomas Gleixner <tglx@linutronix.de>
Date2017-02-12 12:10 +0100
Message-ID<ta0cx-5yR-11@gated-at.bofh.it>
In reply to#1579170
On Sun, 12 Feb 2017, Tobin C. Harding wrote:

> This patch adds function declaration in order to quiet sparse symbol
> not declared warning.

Same comment vs. 'This patch' as before. Hint, we already know that this is
a patch, otherwise it would be mislabeled.

> 
> Signed-off-by: Tobin C. Harding <me@tobin.cc>
> ---
> 
> Unsure why adding declaration quiets sparse.

Because sparse finds a declaration before the definition.

> This may not be the correct solution.

Right, it's not.

> Only testing done is building and booting kernel.  Since 'purgatory' is
> called from assembler and does not need forward declaration the only
> advantage to this patch seems to be to save the next newbie from
> investigating the sparse warning.

Well, yes. But just quietening a checker by slapping a pointless forward
declaration into the code is not pretty either. A smarter checker might
catch that.

The proper solution is to have a local include file 'purgatory.h' and put
the declaration there. Include it in both files even if that's not required
for the ASM file. But that documents, that the function is used outside of
purgatory.c

Thanks,

	tglx

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web