linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zsmalloc: avoid unused-function warning
@ 2023-01-17 17:04 Arnd Bergmann
  2023-01-18  0:39 ` Sergey Senozhatsky
  2023-01-18 19:27 ` Nhat Pham
  0 siblings, 2 replies; 3+ messages in thread
From: Arnd Bergmann @ 2023-01-17 17:04 UTC (permalink / raw)
  To: Minchan Kim, Sergey Senozhatsky, Andrew Morton, Nhat Pham
  Cc: Arnd Bergmann, Sebastian Andrzej Siewior, Alexey Romanov,
	Matthew Wilcox (Oracle),
	linux-mm, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

obj_allocated() can be called from two places that are each
inside of an #ifdef. When both are disabled, the compiler warns:

mm/zsmalloc.c:900:13: error: 'obj_allocated' defined but not used [-Werror=unused-function]

Rather than trying to figure out the correct #ifdef, mark the
trivial function as 'inline', which implies __maybe_unused and
shuts up the warning.

Fixes: 796c71ac728e ("zsmalloc: fix a race with deferred_handles storing")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 mm/zsmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 723ed56d3fbb..9d27d9b00bce 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -937,7 +937,7 @@ static bool obj_tagged(struct page *page, void *obj, unsigned long *phandle,
 	return true;
 }
 
-static bool obj_allocated(struct page *page, void *obj, unsigned long *phandle)
+static inline bool obj_allocated(struct page *page, void *obj, unsigned long *phandle)
 {
 	return obj_tagged(page, obj, phandle, OBJ_ALLOCATED_TAG);
 }
-- 
2.39.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-18 19:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 17:04 [PATCH] zsmalloc: avoid unused-function warning Arnd Bergmann
2023-01-18  0:39 ` Sergey Senozhatsky
2023-01-18 19:27 ` Nhat Pham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox