Skip to contentSkip to conversation

efivars: fix warnings when CONFIG_PSTORE=n

PATCH In review Luck, Tony 4 participants 4 messages Aug 2, 2011

lore
Share & tools
lore

Luck, Tony

author
#0 lore raw

PATCH 1/1 efivars: fix warnings when CONFIG_PSTORE=n

drivers/firmware/efivars.c:161: warning: ‘utf16_strlen’ defined but not used utf16_strlen() is only used inside CONFIG_PSTORE - put same #ifdef around the definition of the function too.

drivers/firmware/efivars.c:602: warning: initialization from incompatible pointer type Between v1 and v2 of this patch series we decided to make the "part" number unsigned - but missed fixing the stub version of efi_pstore_write()

---

drivers/firmware/efivars.c +4 -2
index eacb05e..5315c1e 100644
@@ -157,11 +157,13 @@ utf16_strnlen(efi_char16_t *s, size_t maxlength)
 	return length;
 }
 
+#ifdef CONFIG_PSTORE
 static unsigned long
 utf16_strlen(efi_char16_t *s)
 {
 	return utf16_strnlen(s, ~0UL);
 }
+#endif
 
 /*
  * Return the number of bytes is the length of this string
@@ -580,8 +582,8 @@ static ssize_t efi_pstore_read(u64 *id, enum pstore_type_id *type,
 	return -1;
 }
 
-static u64 efi_pstore_write(enum pstore_type_id type, int part, size_t size,
-			    struct pstore_info *psi)
+static u64 efi_pstore_write(enum pstore_type_id type, unsigned int part,
+			    size_t size, struct pstore_info *psi)
 {
 	return 0;
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tony

drivers/firmware/efivars.c:161: warning: ‘utf16_strlen’ defined but not used utf16_strlen() is only used inside CONFIG_PSTORE - put same #ifdef around the definition of the function too.

drivers/firmware/efivars.c:602: warning: initialization from incompatible pointer type Between v1 and v2 of this patch series we decided to make the "part" number unsigned - but missed fixing the stub version of efi_pstore_write()

Signature · 1 line
Matthew Garrett | [email protected]
#2 lore raw
Quoted 5 lines · Matthew Garrett
Quoted 4 lines · Tony

drivers/firmware/efivars.c:161: warning: ‘utf16_strlen’ defined but not used utf16_strlen() is only used inside CONFIG_PSTORE - put same #ifdef around the definition of the function too.

Quoted 7 lines
Quoted 5 lines

drivers/firmware/efivars.c:602: warning: initialization from incompatible pointer type Between v1 and v2 of this patch series we decided to make the "part" number unsigned - but missed fixing the stub version of efi_pstore_write()

#3 lore raw
In reply to Luck, Tony

drivers/firmware/efivars.c utf16_strnlen(efi_char16_t *s, size_t maxlength) · line 166

Quoted 9 lines · Tony
drivers/firmware/efivars.c +2 -0
+#ifdef CONFIG_PSTORE
 static unsigned long
 utf16_strlen(efi_char16_t *s)
 {
 	return utf16_strnlen(s, ~0UL);
 }
+#endif

Unless this is actually called via an indirect function pointer, it can just be changed to "static inline", which shuts up the warning, too.

-hpa