linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/23] clean up the code related to ASSERT()
@ 2020-08-27 10:14 Chunguang Xu
  2020-08-27 10:14 ` [PATCH 01/23] include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper Chunguang Xu
                   ` (22 more replies)
  0 siblings, 23 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

The kernel has not yet defined ASSERT(). Indeed, BUG() and WARN() are very
clear and can cover most application scenarios. However, some applications
require more debugging information and similar behavior to assert(), which
cannot be directly provided by BUG() and WARN().

Therefore, many modules independently implement ASSERT(), and most of them
are similar, but slightly different, such as:

 #define ASSERT(expr) \
         if(!(expr)) { \
                 printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \
                 panic(#expr); \
         }

 #define ASSERT(x)                                                       \
 do {                                                                    \
         if (!(x)) {                                                     \
                 printk(KERN_EMERG "assertion failed %s: %d: %s\n",      \
                        __FILE__, __LINE__, #x);                         \
                 BUG();                                                  \
         }                                                               \
 } while (0)

Some implementations are not optimal for instruction prediction, such as
missing unlikely():

 #define assert(expr) \
         if(!(expr)) { \
         printk( "Assertion failed! %s,%s,%s,line=%d\n",\
         #expr,__FILE__,__func__,__LINE__); \
         BUG(); \
         }

Some implementations have too little log content information, such as:

 #define ASSERT(X)                                               \
 do {                                                            \
        if (unlikely(!(X))) {                                   \
                printk(KERN_ERR "\n");                          \
                printk(KERN_ERR "XXX: Assertion failed\n");     \
                BUG();                                          \
        }                                                       \
 } while(0)

As we have seen, This makes the code redundant and inconvenient to
troubleshoot the system. Therefore, perhaps we need to define two
wrappers for BUG() and WARN_ON(), such as ASSERT_FAIL() and
ASSERT_WARN(), provide the implementation of ASSERT(), simplify the
code and facilitate problem analysis.

Maybe I missed some information, but I think there is a need to clean
up the code, maybe in other ways, and more discussion is needed here.
If this approach is reasonable, I will clean up these codes later and
issue related patches.

Chunguang Xu (23):
  include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper
  ia64: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  KVM: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  fore200e: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  scsi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  rxrpc: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  lib/mpi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  jfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  cachefiles: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  btrfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  afs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  rivafb: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  nvidia: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  fbdev/cirrusfb:: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  media/staging: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  sym53c8xx: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  8139too: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  net:hns: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  block/sx8: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  skb: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  ext4: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  rbd: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  ALSA: asihpi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code

 arch/ia64/hp/common/sba_iommu.c                    |  6 +---
 arch/x86/kvm/ioapic.h                              |  9 +-----
 drivers/atm/fore200e.c                             |  6 +---
 drivers/block/rbd.c                                |  9 +-----
 drivers/block/skd_main.c                           |  8 +-----
 drivers/block/sx8.c                                |  6 +---
 drivers/net/ethernet/hisilicon/hns/hnae.h          |  8 +-----
 drivers/net/ethernet/realtek/8139too.c             |  6 +---
 drivers/scsi/megaraid/mega_common.h                | 10 ++-----
 drivers/scsi/sym53c8xx_2/sym_hipd.h                |  9 +-----
 .../pci/hive_isp_css_include/assert_support.h      |  6 +---
 drivers/video/fbdev/cirrusfb.c                     |  6 +---
 drivers/video/fbdev/nvidia/nvidia.c                |  7 +----
 drivers/video/fbdev/riva/fbdev.c                   |  7 +----
 fs/afs/internal.h                                  |  9 +-----
 fs/btrfs/ctree.h                                   | 12 +-------
 fs/cachefiles/internal.h                           |  9 +-----
 fs/ext4/mballoc.c                                  | 10 +------
 fs/jfs/jfs_debug.h                                 | 13 +--------
 include/asm-generic/bug.h                          | 33 ++++++++++++++++++++++
 lib/mpi/mpi-internal.h                             |  7 +----
 net/rxrpc/ar-internal.h                            |  8 +-----
 sound/pci/asihpi/hpidebug.h                        |  8 +-----
 23 files changed, 56 insertions(+), 156 deletions(-)

-- 
1.8.3.1


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

* [PATCH 01/23] include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 02/23] ia64: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code Chunguang Xu
                   ` (21 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

The kernel has not yet defined ASSERT(). Indeed, BUG() and WARN() are very
clear and can cover most application scenarios. However, some applications
require more debugging information and similar behavior to assert(), which
cannot be directly provided by BUG() and WARN().

Therefore, many modules independently implement ASSERT(), and most of them
are similar, but slightly different. This makes the code redundant and
inconvenient to troubleshoot the system. Therefore, perhaps we need to
define two wrappers for BUG() and WARN(), provide the implementation of
ASSERT(), simplify the code and facilitate problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 include/asm-generic/bug.h | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 18b0f4e..28f8c27 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -174,6 +174,31 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 	unlikely(__ret_warn_once);				\
 })
 
+/*
+ * ASSERT_FAIL() and ASSERT_WARN() can be used to check whether some
+ * conditions have failed. We generally use ASSERT_FAIL() to check
+ * critical conditions, and other use ASSERT_WARN().
+ */
+#ifndef ASSERT_FAIL
+#define ASSERT_FAIL(condition) do {					\
+	if (unlikely(!(condition))) {					\
+		pr_emerg("Assertion failed: %s, file: %s, line: %d\n",	\
+			  #condition, __FILE__, __LINE__);		\
+		BUG();							\
+	}								\
+} while (0)
+#endif
+
+#ifndef ASSERT_WARN
+#define ASSERT_WARN(condition) do {					\
+	if (unlikely(!(condition))) {					\
+		pr_warn("Assertion failed: %s, file: %s, line: %d\n",	\
+			 #condition, __FILE__, __LINE__);		\
+		WARN_ON(1);						\
+	}								\
+} while (0)
+#endif
+
 #else /* !CONFIG_BUG */
 #ifndef HAVE_ARCH_BUG
 #define BUG() do {} while (1)
@@ -203,6 +228,14 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
 #define WARN_TAINT(condition, taint, format...) WARN(condition, format)
 #define WARN_TAINT_ONCE(condition, taint, format...) WARN(condition, format)
 
+#ifndef ASSERT_FAIL
+#define ASSERT_FAIL(condition) do { } while (0)
+#endif
+
+#ifndef ASSERT_WARN
+#define ASSERT_WARN(condition) do { } while (0)
+#endif
+
 #endif
 
 /*
-- 
1.8.3.1


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

* [PATCH 02/23] ia64: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
  2020-08-27 10:14 ` [PATCH 01/23] include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 03/23] KVM: " Chunguang Xu
                   ` (20 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 arch/ia64/hp/common/sba_iommu.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 656a488..335bf4a 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -138,11 +138,7 @@
 #endif
 
 #ifdef ASSERT_PDIR_SANITY
-#define ASSERT(expr) \
-        if(!(expr)) { \
-                printk( "\n" __FILE__ ":%d: Assertion " #expr " failed!\n",__LINE__); \
-                panic(#expr); \
-        }
+#define ASSERT(expr) ASSERT_FAIL(expr)
 #else
 #define ASSERT(expr)
 #endif
-- 
1.8.3.1


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

* [PATCH 03/23] KVM: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
  2020-08-27 10:14 ` [PATCH 01/23] include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper Chunguang Xu
  2020-08-27 10:14 ` [PATCH 02/23] ia64: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 04/23] fore200e: " Chunguang Xu
                   ` (19 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 arch/x86/kvm/ioapic.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/arch/x86/kvm/ioapic.h b/arch/x86/kvm/ioapic.h
index 6604017..aa0c61a 100644
--- a/arch/x86/kvm/ioapic.h
+++ b/arch/x86/kvm/ioapic.h
@@ -94,14 +94,7 @@ struct kvm_ioapic {
 };
 
 #ifdef DEBUG
-#define ASSERT(x)  							\
-do {									\
-	if (!(x)) {							\
-		printk(KERN_EMERG "assertion failed %s: %d: %s\n",	\
-		       __FILE__, __LINE__, #x);				\
-		BUG();							\
-	}								\
-} while (0)
+#define ASSERT(x) ASSERT_FAIL(x)
 #else
 #define ASSERT(x) do { } while (0)
 #endif
-- 
1.8.3.1


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

* [PATCH 04/23] fore200e: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (2 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 03/23] KVM: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 05/23] scsi: " Chunguang Xu
                   ` (18 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/atm/fore200e.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
index a81bc49..04f121b 100644
--- a/drivers/atm/fore200e.c
+++ b/drivers/atm/fore200e.c
@@ -83,11 +83,7 @@
 #define FORE200E_NEXT_ENTRY(index, modulo)         (index = ((index) + 1) % (modulo))
 
 #if 1
-#define ASSERT(expr)     if (!(expr)) { \
-			     printk(FORE200E "assertion failed! %s[%d]: %s\n", \
-				    __func__, __LINE__, #expr); \
-			     panic(FORE200E "%s", __func__); \
-			 }
+#define ASSERT(expr)     ASSERT_FAIL(expr)
 #else
 #define ASSERT(expr)     do {} while (0)
 #endif
-- 
1.8.3.1


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

* [PATCH 05/23] scsi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (3 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 04/23] fore200e: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
                   ` (17 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/scsi/megaraid/mega_common.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/megaraid/mega_common.h b/drivers/scsi/megaraid/mega_common.h
index 3a7596e..ba3007d 100644
--- a/drivers/scsi/megaraid/mega_common.h
+++ b/drivers/scsi/megaraid/mega_common.h
@@ -253,16 +253,10 @@
 
 #ifdef DEBUG
 #if defined (_ASSERT_PANIC)
-#define ASSERT_ACTION	panic
+#define ASSERT(expression)	ASSERT_FAIL(expression)
 #else
-#define ASSERT_ACTION	printk
+#define ASSERT(expression)	ASSERT_WARN(expression)
 #endif
-
-#define ASSERT(expression)						\
-	if (!(expression)) {						\
-	ASSERT_ACTION("assertion failed:(%s), file: %s, line: %d:%s\n",	\
-			#expression, __FILE__, __LINE__, __func__);	\
-	}
 #else
 #define ASSERT(expression)
 #endif
-- 
1.8.3.1


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

* [PATCH 06/23] rxrpc: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (4 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 05/23] scsi: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 17:10   ` kernel test robot
                     ` (2 more replies)
  2020-08-27 10:14 ` [PATCH 07/23] lib/mpi: " Chunguang Xu
                   ` (16 subsequent siblings)
  22 siblings, 3 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 net/rxrpc/ar-internal.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h
index 6d29a36..b428dc7 100644
--- a/net/rxrpc/ar-internal.h
+++ b/net/rxrpc/ar-internal.h
@@ -1181,13 +1181,7 @@ static inline bool after_eq(u32 seq1, u32 seq2)
  */
 #if 1 // defined(__KDEBUGALL)
 
-#define ASSERT(X)						\
-do {								\
-	if (unlikely(!(X))) {					\
-		pr_err("Assertion failed\n");			\
-		BUG();						\
-	}							\
-} while (0)
+#define ASSERT(X)	ASSERT_FAIL(x)
 
 #define ASSERTCMP(X, OP, Y)						\
 do {									\
-- 
1.8.3.1


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

* [PATCH 07/23] lib/mpi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (5 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 08/23] jfs: " Chunguang Xu
                   ` (15 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 lib/mpi/mpi-internal.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h
index 91df5f0..ee35a69 100644
--- a/lib/mpi/mpi-internal.h
+++ b/lib/mpi/mpi-internal.h
@@ -25,13 +25,8 @@
 #include <linux/errno.h>
 
 #define log_debug printk
-#define log_bug printk
 
-#define assert(x) \
-	do { \
-		if (!x) \
-			log_bug("failed assertion\n"); \
-	} while (0);
+#define assert(x) ASSERT_WARN(x)
 
 /* If KARATSUBA_THRESHOLD is not already defined, define it to a
  * value which is good on most machines.  */
-- 
1.8.3.1


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

* [PATCH 08/23] jfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (6 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 07/23] lib/mpi: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 16:13   ` kernel test robot
  2020-08-27 10:14 ` [PATCH 09/23] cachefiles: " Chunguang Xu
                   ` (14 subsequent siblings)
  22 siblings, 1 reply; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/jfs/jfs_debug.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/fs/jfs/jfs_debug.h b/fs/jfs/jfs_debug.h
index 48e2150..0a2f0e5 100644
--- a/fs/jfs/jfs_debug.h
+++ b/fs/jfs/jfs_debug.h
@@ -24,22 +24,11 @@
 #endif
 
 /*
- *	assert with traditional printf/panic
- */
-#define assert(p) do {	\
-	if (!(p)) {	\
-		printk(KERN_CRIT "BUG at %s:%d assert(%s)\n",	\
-		       __FILE__, __LINE__, #p);			\
-		BUG();	\
-	}		\
-} while (0)
-
-/*
  *	debug ON
  *	--------
  */
 #ifdef CONFIG_JFS_DEBUG
-#define ASSERT(p) assert(p)
+#define ASSERT(p) ASSERT_FAIL(p)
 
 /* printk verbosity */
 #define JFS_LOGLEVEL_ERR 1
-- 
1.8.3.1


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

* [PATCH 09/23] cachefiles: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (7 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 08/23] jfs: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-28  4:30   ` kernel test robot
  2020-08-27 10:14 ` [PATCH 10/23] btrfs: " Chunguang Xu
                   ` (13 subsequent siblings)
  22 siblings, 1 reply; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/cachefiles/internal.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h
index cf9bd64..2447437 100644
--- a/fs/cachefiles/internal.h
+++ b/fs/cachefiles/internal.h
@@ -316,14 +316,7 @@ extern int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,
 
 #if 1 /* defined(__KDEBUGALL) */
 
-#define ASSERT(X)							\
-do {									\
-	if (unlikely(!(X))) {						\
-		pr_err("\n");						\
-		pr_err("Assertion failed\n");		\
-		BUG();							\
-	}								\
-} while (0)
+#define ASSERT(X) ASSERT_FAIL(x)
 
 #define ASSERTCMP(X, OP, Y)						\
 do {									\
-- 
1.8.3.1


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

* [PATCH 10/23] btrfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (8 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 09/23] cachefiles: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 11/23] afs: " Chunguang Xu
                   ` (12 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/btrfs/ctree.h | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 9c7e466..9254dc6 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -3226,18 +3226,8 @@ void btrfs_no_printk(const struct btrfs_fs_info *fs_info, const char *fmt, ...)
 } while (0)
 
 #ifdef CONFIG_BTRFS_ASSERT
-__cold __noreturn
-static inline void assertfail(const char *expr, const char *file, int line)
-{
-	pr_err("assertion failed: %s, in %s:%d\n", expr, file, line);
-	BUG();
-}
-
-#define ASSERT(expr)						\
-	(likely(expr) ? (void)0 : assertfail(#expr, __FILE__, __LINE__))
-
+#define ASSERT(expr)	ASSERT_FAIL(expr)
 #else
-static inline void assertfail(const char *expr, const char* file, int line) { }
 #define ASSERT(expr)	(void)(expr)
 #endif
 
-- 
1.8.3.1


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

* [PATCH 11/23] afs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (9 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 10/23] btrfs: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 16:29   ` kernel test robot
  2020-08-28  9:49   ` kernel test robot
  2020-08-27 10:14 ` [PATCH 12/23] rivafb: " Chunguang Xu
                   ` (11 subsequent siblings)
  22 siblings, 2 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/afs/internal.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/fs/afs/internal.h b/fs/afs/internal.h
index 792ac71..72594e5 100644
--- a/fs/afs/internal.h
+++ b/fs/afs/internal.h
@@ -1580,14 +1580,7 @@ static inline int afs_bad(struct afs_vnode *vnode, enum afs_file_error where)
  */
 #if 1 // defined(__KDEBUGALL)
 
-#define ASSERT(X)						\
-do {								\
-	if (unlikely(!(X))) {					\
-		printk(KERN_ERR "\n");				\
-		printk(KERN_ERR "AFS: Assertion failed\n");	\
-		BUG();						\
-	}							\
-} while(0)
+#define ASSERT(X) ASSERT_FAIL(x)
 
 #define ASSERTCMP(X, OP, Y)						\
 do {									\
-- 
1.8.3.1


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

* [PATCH 12/23] rivafb: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (10 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 11/23] afs: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 13/23] nvidia: " Chunguang Xu
                   ` (10 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/video/fbdev/riva/fbdev.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/riva/fbdev.c b/drivers/video/fbdev/riva/fbdev.c
index 9b34938..8a2e768 100644
--- a/drivers/video/fbdev/riva/fbdev.c
+++ b/drivers/video/fbdev/riva/fbdev.c
@@ -67,12 +67,7 @@
 #define NVTRACE_LEAVE(...)  NVTRACE("%s END\n", __func__)
 
 #ifdef CONFIG_FB_RIVA_DEBUG
-#define assert(expr) \
-	if(!(expr)) { \
-	printk( "Assertion failed! %s,%s,%s,line=%d\n",\
-	#expr,__FILE__,__func__,__LINE__); \
-	BUG(); \
-	}
+#define assert(expr) ASSERT_FAIL(expr)
 #else
 #define assert(expr)
 #endif
-- 
1.8.3.1


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

* [PATCH 13/23] nvidia: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (11 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 12/23] rivafb: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 14/23] fbdev/cirrusfb:: " Chunguang Xu
                   ` (9 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/video/fbdev/nvidia/nvidia.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nvidia.c b/drivers/video/fbdev/nvidia/nvidia.c
index c6820e2..f5b3a9a 100644
--- a/drivers/video/fbdev/nvidia/nvidia.c
+++ b/drivers/video/fbdev/nvidia/nvidia.c
@@ -40,12 +40,7 @@
 #define NVTRACE_LEAVE(...)  NVTRACE("%s END\n", __func__)
 
 #ifdef CONFIG_FB_NVIDIA_DEBUG
-#define assert(expr) \
-	if (!(expr)) { \
-	printk( "Assertion failed! %s,%s,%s,line=%d\n",\
-	#expr,__FILE__,__func__,__LINE__); \
-	BUG(); \
-	}
+#define assert(expr) ASSERT_FAIL(expr)
 #else
 #define assert(expr)
 #endif
-- 
1.8.3.1


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

* [PATCH 14/23] fbdev/cirrusfb:: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (12 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 13/23] nvidia: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 15/23] media/staging: " Chunguang Xu
                   ` (8 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/video/fbdev/cirrusfb.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/cirrusfb.c b/drivers/video/fbdev/cirrusfb.c
index 3df64a9..3dcafdd 100644
--- a/drivers/video/fbdev/cirrusfb.c
+++ b/drivers/video/fbdev/cirrusfb.c
@@ -67,11 +67,7 @@
 
 /* debugging assertions */
 #ifndef CIRRUSFB_NDEBUG
-#define assert(expr) \
-	if (!(expr)) { \
-		printk("Assertion failed! %s,%s,%s,line=%d\n", \
-		#expr, __FILE__, __func__, __LINE__); \
-	}
+#define assert(expr) ASSERT_WARN(expr)
 #else
 #define assert(expr)
 #endif
-- 
1.8.3.1


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

* [PATCH 15/23] media/staging: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (13 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 14/23] fbdev/cirrusfb:: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 16/23] sym53c8xx: " Chunguang Xu
                   ` (7 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 .../staging/media/atomisp/pci/hive_isp_css_include/assert_support.h | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h b/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
index 7382c0b..c7e65e3 100644
--- a/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
+++ b/drivers/staging/media/atomisp/pci/hive_isp_css_include/assert_support.h
@@ -51,11 +51,7 @@
  * but that causes many compiler warnings (==errors) under Android
  * because it seems that the BUG_ON() macro is not seen as a check by
  * gcc like the BUG() macro is. */
-#define assert(cnd) \
-	do { \
-		if (!(cnd)) \
-			BUG(); \
-	} while (0)
+#define assert(cnd) ASSERT_FAIL(cnd)
 
 #ifndef PIPE_GENERATION
 /* Deprecated OP___assert, this is still used in ~1000 places
-- 
1.8.3.1


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

* [PATCH 16/23] sym53c8xx: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (14 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 15/23] media/staging: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 17/23] 8139too: " Chunguang Xu
                   ` (6 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/scsi/sym53c8xx_2/sym_hipd.h | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index 9231a28..0676c94 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -79,14 +79,7 @@
  *  These ones should have been already defined.
  */
 #ifndef assert
-#define	assert(expression) { \
-	if (!(expression)) { \
-		(void)panic( \
-			"assertion \"%s\" failed: file \"%s\", line %d\n", \
-			#expression, \
-			__FILE__, __LINE__); \
-	} \
-}
+#define	assert(expression) ASSERT_FAIL(expression)
 #endif
 
 /*
-- 
1.8.3.1


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

* [PATCH 17/23] 8139too: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (15 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 16/23] sym53c8xx: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 18/23] net:hns: " Chunguang Xu
                   ` (5 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/net/ethernet/realtek/8139too.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/realtek/8139too.c b/drivers/net/ethernet/realtek/8139too.c
index 227139d..0973d1e 100644
--- a/drivers/net/ethernet/realtek/8139too.c
+++ b/drivers/net/ethernet/realtek/8139too.c
@@ -133,11 +133,7 @@
 #ifdef RTL8139_NDEBUG
 #  define assert(expr) do {} while (0)
 #else
-#  define assert(expr) \
-        if (unlikely(!(expr))) {				\
-		pr_err("Assertion failed! %s,%s,%s,line=%d\n",	\
-		       #expr, __FILE__, __func__, __LINE__);	\
-        }
+#  define assert(expr) ASSERT_WARN(expr)
 #endif
 
 
-- 
1.8.3.1


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

* [PATCH 18/23] net:hns: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (16 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 17/23] 8139too: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 19/23] block/sx8: " Chunguang Xu
                   ` (4 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/net/ethernet/hisilicon/hns/hnae.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 6ab9458..55710f4 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -41,13 +41,7 @@
 #ifdef DEBUG
 
 #ifndef assert
-#define assert(expr) \
-do { \
-	if (!(expr)) { \
-		pr_err("Assertion failed! %s, %s, %s, line %d\n", \
-			   #expr, __FILE__, __func__, __LINE__); \
-	} \
-} while (0)
+#define assert(expr) ASSERT_WARN(expr)
 #endif
 
 #else
-- 
1.8.3.1


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

* [PATCH 19/23] block/sx8: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (17 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 18/23] net:hns: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 20/23] skb: " Chunguang Xu
                   ` (3 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/block/sx8.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/block/sx8.c b/drivers/block/sx8.c
index 4478eb7..d9adcf3 100644
--- a/drivers/block/sx8.c
+++ b/drivers/block/sx8.c
@@ -93,11 +93,7 @@
 #ifdef CARM_NDEBUG
 #define assert(expr)
 #else
-#define assert(expr) \
-        if(unlikely(!(expr))) {                                   \
-        printk(KERN_ERR "Assertion failed! %s,%s,%s,line=%d\n", \
-	#expr, __FILE__, __func__, __LINE__);          \
-        }
+#define assert(expr) ASSERT_WARN(expr)
 #endif
 
 /* defines only for the constants which don't work well as enums */
-- 
1.8.3.1


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

* [PATCH 20/23] skb: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (18 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 19/23] block/sx8: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 21/23] ext4: " Chunguang Xu
                   ` (2 subsequent siblings)
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/block/skd_main.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index 3a476dc..b5b51e0 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -41,13 +41,7 @@
 static int skd_dbg_level;
 static int skd_isr_comp_limit = 4;
 
-#define SKD_ASSERT(expr) \
-	do { \
-		if (unlikely(!(expr))) { \
-			pr_err("Assertion failed! %s,%s,%s,line=%d\n",	\
-			       # expr, __FILE__, __func__, __LINE__); \
-		} \
-	} while (0)
+#define SKD_ASSERT(expr) ASSERT_WARN(expr)
 
 #define DRV_NAME "skd"
 #define PFX DRV_NAME ": "
-- 
1.8.3.1


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

* [PATCH 21/23] ext4: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (19 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 20/23] skb: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 22/23] rbd: " Chunguang Xu
  2020-08-27 10:14 ` [PATCH 23/23] ALSA: asihpi: " Chunguang Xu
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 fs/ext4/mballoc.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index c0a331e..99976e6 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -591,15 +591,7 @@ static inline void mb_group_bb_bitmap_free(struct ext4_group_info *grp)
 
 #ifdef AGGRESSIVE_CHECK
 
-#define MB_CHECK_ASSERT(assert)						\
-do {									\
-	if (!(assert)) {						\
-		printk(KERN_EMERG					\
-			"Assertion failure in %s() at %s:%d: \"%s\"\n",	\
-			function, file, line, # assert);		\
-		BUG();							\
-	}								\
-} while (0)
+#define MB_CHECK_ASSERT(assert) ASSERT_FAIL(assert)
 
 static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
 				const char *function, int line)
-- 
1.8.3.1


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

* [PATCH 22/23] rbd: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (20 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 21/23] ext4: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  2020-08-27 10:14 ` [PATCH 23/23] ALSA: asihpi: " Chunguang Xu
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 drivers/block/rbd.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index d9c0e7d..798b9ad 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -617,14 +617,7 @@ void rbd_warn(struct rbd_device *rbd_dev, const char *fmt, ...)
 }
 
 #ifdef RBD_DEBUG
-#define rbd_assert(expr)						\
-		if (unlikely(!(expr))) {				\
-			printk(KERN_ERR "\nAssertion failure in %s() "	\
-						"at line %d:\n\n"	\
-					"\trbd_assert(%s);\n\n",	\
-					__func__, __LINE__, #expr);	\
-			BUG();						\
-		}
+#define rbd_assert(expr)	ASSERT_FAIL(expr)
 #else /* !RBD_DEBUG */
 #  define rbd_assert(expr)	((void) 0)
 #endif /* !RBD_DEBUG */
-- 
1.8.3.1


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

* [PATCH 23/23] ALSA: asihpi: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
                   ` (21 preceding siblings ...)
  2020-08-27 10:14 ` [PATCH 22/23] rbd: " Chunguang Xu
@ 2020-08-27 10:14 ` Chunguang Xu
  22 siblings, 0 replies; 31+ messages in thread
From: Chunguang Xu @ 2020-08-27 10:14 UTC (permalink / raw)
  To: arnd; +Cc: rppt, linux-arch, linux-kernel

Since ASSERT_FAIL() and ASSERT_WARN() have been provided, ASSERT()
may be realized through them, thus reducing code redundancy and
facilitating problem analysis.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
---
 sound/pci/asihpi/hpidebug.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/sound/pci/asihpi/hpidebug.h b/sound/pci/asihpi/hpidebug.h
index c24ed69..b65c8dc 100644
--- a/sound/pci/asihpi/hpidebug.h
+++ b/sound/pci/asihpi/hpidebug.h
@@ -34,13 +34,7 @@ enum { HPI_DEBUG_LEVEL_ERROR = 0,	/* always log errors */
 #define FILE_LINE  __FILE__ ":" __stringify(__LINE__) " "
 #endif
 
-#define HPI_DEBUG_ASSERT(expression) \
-	do { \
-		if (!(expression)) { \
-			printk(KERN_ERR  FILE_LINE \
-				"ASSERT " __stringify(expression)); \
-		} \
-	} while (0)
+#define HPI_DEBUG_ASSERT(expression) ASSERT_WARN(expression)
 
 #define HPI_DEBUG_LOG(level, ...) \
 	do { \
-- 
1.8.3.1


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

* Re: [PATCH 08/23] jfs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 08/23] jfs: " Chunguang Xu
@ 2020-08-27 16:13   ` kernel test robot
  0 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-27 16:13 UTC (permalink / raw)
  To: Chunguang Xu, arnd
  Cc: kbuild-all, clang-built-linux, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 21693 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master asm-generic/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a014-20200827 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> fs/jfs/namei.c:524:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(!test_cflag(COMMIT_Nolink, ip));
                   ^
   fs/jfs/namei.c:640:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(filetype != S_IFDIR);
                   ^
   fs/jfs/namei.c:1191:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(!test_cflag(COMMIT_Nolink, new_ip));
                           ^
   3 errors generated.
--
>> fs/jfs/jfs_xtree.c:494:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   BT_PUSH(btstack, bn, index);
                   ^
   fs/jfs/jfs_btree.h:119:2: note: expanded from macro 'BT_PUSH'
           assert(!BT_STACK_FULL(BTSTACK));\
           ^
   fs/jfs/jfs_xtree.c:3180:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(flag != COMMIT_PMAP);
           ^
   fs/jfs/jfs_xtree.c:3843:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           BT_PUSH(&btstack, bn, index);
           ^
   fs/jfs/jfs_btree.h:119:2: note: expanded from macro 'BT_PUSH'
           assert(!BT_STACK_FULL(BTSTACK));\
           ^
   3 errors generated.
--
>> fs/jfs/jfs_imap.c:679:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(tlck->type & tlckXTREE);
                   ^
   fs/jfs/jfs_imap.c:1095:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(ciagp != NULL);
                           ^
   fs/jfs/jfs_imap.c:1109:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(diagp != NULL);
                           ^
   fs/jfs/jfs_imap.c:1428:6: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                                           assert(rc == -EIO);
                                           ^
   fs/jfs/jfs_imap.c:1511:6: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                                           assert(rc == -EIO);
                                           ^
   fs/jfs/jfs_imap.c:1550:6: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                                           assert(rc == -EIO);
                                           ^
   fs/jfs/jfs_imap.c:2689:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(start < 32);
           ^
   fs/jfs/jfs_imap.c:2813:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(mp->clsn);
                   ^
   8 errors generated.
--
>> fs/jfs/jfs_dmap.c:700:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(nblocks > 0);
           ^
   fs/jfs/jfs_dmap.c:1865:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert((blkno & (BPERDMAP - 1)) == 0);
           ^
   fs/jfs/jfs_dmap.c:1991:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(l2nb <= L2BPERDMAP);
           ^
   fs/jfs/jfs_dmap.c:2182:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(dbitno + nblocks <= BPERDMAP);
           ^
   fs/jfs/jfs_dmap.c:2327:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(dbitno + nblocks <= BPERDMAP);
           ^
   fs/jfs/jfs_dmap.c:2612:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(level == bmp->db_maxlevel);
                           ^
   fs/jfs/jfs_dmap.c:2721:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(leaf[leafno] == NOFREE);
           ^
   fs/jfs/jfs_dmap.c:2989:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(n < 4);
                   ^
   fs/jfs/jfs_dmap.c:3025:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(nb <= DBWORD);
           ^
   fs/jfs/jfs_dmap.c:3172:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(0);
           ^
   fs/jfs/jfs_dmap.c:3270:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(dbitno + nblocks <= BPERDMAP);
           ^
   11 errors generated.
--
>> fs/jfs/jfs_dtree.c:775:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   BT_PUSH(btstack, bn, index);
                   ^
   fs/jfs/jfs_btree.h:119:2: note: expanded from macro 'BT_PUSH'
           assert(!BT_STACK_FULL(BTSTACK));\
           ^
   fs/jfs/jfs_dtree.c:3376:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   BT_PUSH(btstack, bn, 0);
                   ^
   fs/jfs/jfs_btree.h:119:2: note: expanded from macro 'BT_PUSH'
           assert(!BT_STACK_FULL(BTSTACK));\
           ^
   2 errors generated.
--
>> fs/jfs/jfs_metapage.c:739:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(mp->count);
           ^
   1 error generated.
--
>> fs/jfs/jfs_logmgr.c:1595:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(list_empty(&log->cqueue));
           ^
   fs/jfs/jfs_logmgr.c:1929:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(bp->l_wqnext == NULL);
           ^
   fs/jfs/jfs_logmgr.c:2312:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(bp->l_flag & lbmRELEASE);
                   ^
   3 errors generated.
--
>> fs/jfs/jfs_txnmgr.c:523:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(tblk->next == 0);
           ^
   fs/jfs/jfs_txnmgr.c:656:5: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                                   assert(last);
                                   ^
   fs/jfs/jfs_txnmgr.c:875:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(mp->xflag & COMMIT_PAGE);
                           ^
   fs/jfs/jfs_txnmgr.c:920:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(mp->xflag & COMMIT_PAGE);
                           ^
   fs/jfs/jfs_txnmgr.c:2241:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(mp->xflag & COMMIT_PAGE);
                           ^
   fs/jfs/jfs_txnmgr.c:2372:4: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                           assert(mp->nohomeok == 1);
                           ^
   fs/jfs/jfs_txnmgr.c:2827:2: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
           assert(mp->nohomeok);
           ^
   7 errors generated.
--
>> fs/jfs/xattr.c:153:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(size <= sizeof (ji->i_inline_ea));
                   ^
   fs/jfs/xattr.c:583:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(ea_buf->mp);
                   ^
   fs/jfs/xattr.c:603:3: error: implicit declaration of function 'assert' [-Werror,-Wimplicit-function-declaration]
                   assert(new_size <= sizeof (ji->i_inline_ea));
                   ^
   3 errors generated.

# https://github.com/0day-ci/linux/commit/073244e1adc3932156c9523a347b3edec3d87a9d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 073244e1adc3932156c9523a347b3edec3d87a9d
vim +/assert +524 fs/jfs/namei.c

^1da177e4c3f41 Linus Torvalds    2005-04-16  441  
^1da177e4c3f41 Linus Torvalds    2005-04-16  442  /*
^1da177e4c3f41 Linus Torvalds    2005-04-16  443   * NAME:	jfs_unlink(dip, dentry)
^1da177e4c3f41 Linus Torvalds    2005-04-16  444   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  445   * FUNCTION:	remove a link to object <vp> named by <name>
^1da177e4c3f41 Linus Torvalds    2005-04-16  446   *		from parent directory <dvp>
^1da177e4c3f41 Linus Torvalds    2005-04-16  447   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  448   * PARAMETER:	dip	- inode of parent directory
^1da177e4c3f41 Linus Torvalds    2005-04-16  449   *		dentry	- dentry of object to be removed
^1da177e4c3f41 Linus Torvalds    2005-04-16  450   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  451   * RETURN:	errors from subroutines
^1da177e4c3f41 Linus Torvalds    2005-04-16  452   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  453   * note:
^1da177e4c3f41 Linus Torvalds    2005-04-16  454   * temporary file: if one or more processes have the file open
^1da177e4c3f41 Linus Torvalds    2005-04-16  455   * when the last link is removed, the link will be removed before
^1da177e4c3f41 Linus Torvalds    2005-04-16  456   * unlink() returns, but the removal of the file contents will be
^1da177e4c3f41 Linus Torvalds    2005-04-16  457   * postponed until all references to the files are closed.
^1da177e4c3f41 Linus Torvalds    2005-04-16  458   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  459   * JFS does NOT support unlink() on directories.
^1da177e4c3f41 Linus Torvalds    2005-04-16  460   *
^1da177e4c3f41 Linus Torvalds    2005-04-16  461   */
^1da177e4c3f41 Linus Torvalds    2005-04-16  462  static int jfs_unlink(struct inode *dip, struct dentry *dentry)
^1da177e4c3f41 Linus Torvalds    2005-04-16  463  {
^1da177e4c3f41 Linus Torvalds    2005-04-16  464  	int rc;
^1da177e4c3f41 Linus Torvalds    2005-04-16  465  	tid_t tid;		/* transaction id */
2b0143b5c986be David Howells     2015-03-17  466  	struct inode *ip = d_inode(dentry);
^1da177e4c3f41 Linus Torvalds    2005-04-16  467  	ino_t ino;
^1da177e4c3f41 Linus Torvalds    2005-04-16  468  	struct component_name dname;	/* object name */
^1da177e4c3f41 Linus Torvalds    2005-04-16  469  	struct inode *iplist[2];
^1da177e4c3f41 Linus Torvalds    2005-04-16  470  	struct tblock *tblk;
^1da177e4c3f41 Linus Torvalds    2005-04-16  471  	s64 new_size = 0;
^1da177e4c3f41 Linus Torvalds    2005-04-16  472  	int commit_flag;
^1da177e4c3f41 Linus Torvalds    2005-04-16  473  
a455589f181e60 Al Viro           2014-10-21  474  	jfs_info("jfs_unlink: dip:0x%p name:%pd", dip, dentry);
^1da177e4c3f41 Linus Torvalds    2005-04-16  475  
^1da177e4c3f41 Linus Torvalds    2005-04-16  476  	/* Init inode for quota operations. */
acc84b05b1f463 Dave Kleikamp     2015-07-15  477  	rc = dquot_initialize(dip);
acc84b05b1f463 Dave Kleikamp     2015-07-15  478  	if (rc)
acc84b05b1f463 Dave Kleikamp     2015-07-15  479  		goto out;
acc84b05b1f463 Dave Kleikamp     2015-07-15  480  	rc = dquot_initialize(ip);
acc84b05b1f463 Dave Kleikamp     2015-07-15  481  	if (rc)
acc84b05b1f463 Dave Kleikamp     2015-07-15  482  		goto out;
^1da177e4c3f41 Linus Torvalds    2005-04-16  483  
^1da177e4c3f41 Linus Torvalds    2005-04-16  484  	if ((rc = get_UCSname(&dname, dentry)))
^1da177e4c3f41 Linus Torvalds    2005-04-16  485  		goto out;
^1da177e4c3f41 Linus Torvalds    2005-04-16  486  
82d5b9a7c63054 Dave Kleikamp     2007-01-09  487  	IWRITE_LOCK(ip, RDWRLOCK_NORMAL);
^1da177e4c3f41 Linus Torvalds    2005-04-16  488  
^1da177e4c3f41 Linus Torvalds    2005-04-16  489  	tid = txBegin(dip->i_sb, 0);
^1da177e4c3f41 Linus Torvalds    2005-04-16  490  
82d5b9a7c63054 Dave Kleikamp     2007-01-09  491  	mutex_lock_nested(&JFS_IP(dip)->commit_mutex, COMMIT_MUTEX_PARENT);
82d5b9a7c63054 Dave Kleikamp     2007-01-09  492  	mutex_lock_nested(&JFS_IP(ip)->commit_mutex, COMMIT_MUTEX_CHILD);
^1da177e4c3f41 Linus Torvalds    2005-04-16  493  
^1da177e4c3f41 Linus Torvalds    2005-04-16  494  	iplist[0] = dip;
^1da177e4c3f41 Linus Torvalds    2005-04-16  495  	iplist[1] = ip;
^1da177e4c3f41 Linus Torvalds    2005-04-16  496  
^1da177e4c3f41 Linus Torvalds    2005-04-16  497  	/*
^1da177e4c3f41 Linus Torvalds    2005-04-16  498  	 * delete the entry of target file from parent directory
^1da177e4c3f41 Linus Torvalds    2005-04-16  499  	 */
^1da177e4c3f41 Linus Torvalds    2005-04-16  500  	ino = ip->i_ino;
^1da177e4c3f41 Linus Torvalds    2005-04-16  501  	if ((rc = dtDelete(tid, dip, &dname, &ino, JFS_REMOVE))) {
^1da177e4c3f41 Linus Torvalds    2005-04-16  502  		jfs_err("jfs_unlink: dtDelete returned %d", rc);
^1da177e4c3f41 Linus Torvalds    2005-04-16  503  		if (rc == -EIO)
^1da177e4c3f41 Linus Torvalds    2005-04-16  504  			txAbort(tid, 1);	/* Marks FS Dirty */
^1da177e4c3f41 Linus Torvalds    2005-04-16  505  		txEnd(tid);
1de87444f8f910 Ingo Molnar       2006-01-24  506  		mutex_unlock(&JFS_IP(ip)->commit_mutex);
48ce8b056c8892 Evgeniy Dushistov 2006-06-05  507  		mutex_unlock(&JFS_IP(dip)->commit_mutex);
^1da177e4c3f41 Linus Torvalds    2005-04-16  508  		IWRITE_UNLOCK(ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  509  		goto out1;
^1da177e4c3f41 Linus Torvalds    2005-04-16  510  	}
^1da177e4c3f41 Linus Torvalds    2005-04-16  511  
^1da177e4c3f41 Linus Torvalds    2005-04-16  512  	ASSERT(ip->i_nlink);
^1da177e4c3f41 Linus Torvalds    2005-04-16  513  
078cd8279e6599 Deepa Dinamani    2016-09-14  514  	ip->i_ctime = dip->i_ctime = dip->i_mtime = current_time(ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  515  	mark_inode_dirty(dip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  516  
^1da177e4c3f41 Linus Torvalds    2005-04-16  517  	/* update target's inode */
9a53c3a783c2fa Dave Hansen       2006-09-30  518  	inode_dec_link_count(ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  519  
^1da177e4c3f41 Linus Torvalds    2005-04-16  520  	/*
^1da177e4c3f41 Linus Torvalds    2005-04-16  521  	 *	commit zero link count object
^1da177e4c3f41 Linus Torvalds    2005-04-16  522  	 */
^1da177e4c3f41 Linus Torvalds    2005-04-16  523  	if (ip->i_nlink == 0) {
^1da177e4c3f41 Linus Torvalds    2005-04-16 @524  		assert(!test_cflag(COMMIT_Nolink, ip));
^1da177e4c3f41 Linus Torvalds    2005-04-16  525  		/* free block resources */
^1da177e4c3f41 Linus Torvalds    2005-04-16  526  		if ((new_size = commitZeroLink(tid, ip)) < 0) {
^1da177e4c3f41 Linus Torvalds    2005-04-16  527  			txAbort(tid, 1);	/* Marks FS Dirty */
^1da177e4c3f41 Linus Torvalds    2005-04-16  528  			txEnd(tid);
1de87444f8f910 Ingo Molnar       2006-01-24  529  			mutex_unlock(&JFS_IP(ip)->commit_mutex);
48ce8b056c8892 Evgeniy Dushistov 2006-06-05  530  			mutex_unlock(&JFS_IP(dip)->commit_mutex);
^1da177e4c3f41 Linus Torvalds    2005-04-16  531  			IWRITE_UNLOCK(ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  532  			rc = new_size;
^1da177e4c3f41 Linus Torvalds    2005-04-16  533  			goto out1;
^1da177e4c3f41 Linus Torvalds    2005-04-16  534  		}
^1da177e4c3f41 Linus Torvalds    2005-04-16  535  		tblk = tid_to_tblock(tid);
^1da177e4c3f41 Linus Torvalds    2005-04-16  536  		tblk->xflag |= COMMIT_DELETE;
^1da177e4c3f41 Linus Torvalds    2005-04-16  537  		tblk->u.ip = ip;
^1da177e4c3f41 Linus Torvalds    2005-04-16  538  	}
^1da177e4c3f41 Linus Torvalds    2005-04-16  539  
^1da177e4c3f41 Linus Torvalds    2005-04-16  540  	/*
^1da177e4c3f41 Linus Torvalds    2005-04-16  541  	 * Incomplete truncate of file data can
^1da177e4c3f41 Linus Torvalds    2005-04-16  542  	 * result in timing problems unless we synchronously commit the
^1da177e4c3f41 Linus Torvalds    2005-04-16  543  	 * transaction.
^1da177e4c3f41 Linus Torvalds    2005-04-16  544  	 */
^1da177e4c3f41 Linus Torvalds    2005-04-16  545  	if (new_size)
^1da177e4c3f41 Linus Torvalds    2005-04-16  546  		commit_flag = COMMIT_SYNC;
^1da177e4c3f41 Linus Torvalds    2005-04-16  547  	else
^1da177e4c3f41 Linus Torvalds    2005-04-16  548  		commit_flag = 0;
^1da177e4c3f41 Linus Torvalds    2005-04-16  549  
^1da177e4c3f41 Linus Torvalds    2005-04-16  550  	/*
^1da177e4c3f41 Linus Torvalds    2005-04-16  551  	 * If xtTruncate was incomplete, commit synchronously to avoid
^1da177e4c3f41 Linus Torvalds    2005-04-16  552  	 * timing complications
^1da177e4c3f41 Linus Torvalds    2005-04-16  553  	 */
^1da177e4c3f41 Linus Torvalds    2005-04-16  554  	rc = txCommit(tid, 2, &iplist[0], commit_flag);
^1da177e4c3f41 Linus Torvalds    2005-04-16  555  
^1da177e4c3f41 Linus Torvalds    2005-04-16  556  	txEnd(tid);
^1da177e4c3f41 Linus Torvalds    2005-04-16  557  
1de87444f8f910 Ingo Molnar       2006-01-24  558  	mutex_unlock(&JFS_IP(ip)->commit_mutex);
48ce8b056c8892 Evgeniy Dushistov 2006-06-05  559  	mutex_unlock(&JFS_IP(dip)->commit_mutex);
^1da177e4c3f41 Linus Torvalds    2005-04-16  560  
^1da177e4c3f41 Linus Torvalds    2005-04-16  561  	while (new_size && (rc == 0)) {
^1da177e4c3f41 Linus Torvalds    2005-04-16  562  		tid = txBegin(dip->i_sb, 0);
1de87444f8f910 Ingo Molnar       2006-01-24  563  		mutex_lock(&JFS_IP(ip)->commit_mutex);
^1da177e4c3f41 Linus Torvalds    2005-04-16  564  		new_size = xtTruncate_pmap(tid, ip, new_size);
^1da177e4c3f41 Linus Torvalds    2005-04-16  565  		if (new_size < 0) {
^1da177e4c3f41 Linus Torvalds    2005-04-16  566  			txAbort(tid, 1);	/* Marks FS Dirty */
^1da177e4c3f41 Linus Torvalds    2005-04-16  567  			rc = new_size;
^1da177e4c3f41 Linus Torvalds    2005-04-16  568  		} else
^1da177e4c3f41 Linus Torvalds    2005-04-16  569  			rc = txCommit(tid, 2, &iplist[0], COMMIT_SYNC);
^1da177e4c3f41 Linus Torvalds    2005-04-16  570  		txEnd(tid);
1de87444f8f910 Ingo Molnar       2006-01-24  571  		mutex_unlock(&JFS_IP(ip)->commit_mutex);
^1da177e4c3f41 Linus Torvalds    2005-04-16  572  	}
^1da177e4c3f41 Linus Torvalds    2005-04-16  573  
^1da177e4c3f41 Linus Torvalds    2005-04-16  574  	if (ip->i_nlink == 0)
^1da177e4c3f41 Linus Torvalds    2005-04-16  575  		set_cflag(COMMIT_Nolink, ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  576  
^1da177e4c3f41 Linus Torvalds    2005-04-16  577  	IWRITE_UNLOCK(ip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  578  
^1da177e4c3f41 Linus Torvalds    2005-04-16  579  	/*
^1da177e4c3f41 Linus Torvalds    2005-04-16  580  	 * Truncating the directory index table is not guaranteed.  It
^1da177e4c3f41 Linus Torvalds    2005-04-16  581  	 * may need to be done iteratively
^1da177e4c3f41 Linus Torvalds    2005-04-16  582  	 */
^1da177e4c3f41 Linus Torvalds    2005-04-16  583  	if (test_cflag(COMMIT_Stale, dip)) {
^1da177e4c3f41 Linus Torvalds    2005-04-16  584  		if (dip->i_size > 1)
^1da177e4c3f41 Linus Torvalds    2005-04-16  585  			jfs_truncate_nolock(dip, 0);
^1da177e4c3f41 Linus Torvalds    2005-04-16  586  
^1da177e4c3f41 Linus Torvalds    2005-04-16  587  		clear_cflag(COMMIT_Stale, dip);
^1da177e4c3f41 Linus Torvalds    2005-04-16  588  	}
^1da177e4c3f41 Linus Torvalds    2005-04-16  589  
^1da177e4c3f41 Linus Torvalds    2005-04-16  590        out1:
^1da177e4c3f41 Linus Torvalds    2005-04-16  591  	free_UCSname(&dname);
^1da177e4c3f41 Linus Torvalds    2005-04-16  592        out:
^1da177e4c3f41 Linus Torvalds    2005-04-16  593  	jfs_info("jfs_unlink: rc:%d", rc);
^1da177e4c3f41 Linus Torvalds    2005-04-16  594  	return rc;
^1da177e4c3f41 Linus Torvalds    2005-04-16  595  }
^1da177e4c3f41 Linus Torvalds    2005-04-16  596  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31508 bytes --]

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

* Re: [PATCH 11/23] afs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 11/23] afs: " Chunguang Xu
@ 2020-08-27 16:29   ` kernel test robot
  2020-08-28  9:49   ` kernel test robot
  1 sibling, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-27 16:29 UTC (permalink / raw)
  To: Chunguang Xu, arnd
  Cc: kbuild-all, clang-built-linux, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7199 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master v5.9-rc2 next-20200827]
[cannot apply to asm-generic/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a012-20200827 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> fs/afs/callback.c:179:2: error: use of undeclared identifier 'x'
           ASSERT(server != NULL);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/cell.c:130:2: error: use of undeclared identifier 'x'
           ASSERT(name);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/file.c:398:3: error: use of undeclared identifier 'x'
                   ASSERT(key != NULL);
                   ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/file.c:553:2: error: use of undeclared identifier 'x'
           ASSERT(key != NULL);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   2 errors generated.
--
>> fs/afs/flock.c:326:3: error: use of undeclared identifier 'x'
                   ASSERT(!list_empty(&vnode->granted_locks));
                   ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/flock.c:591:3: error: use of undeclared identifier 'x'
                   ASSERT(list_empty(&vnode->granted_locks));
                   ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   2 errors generated.
--
>> fs/afs/fsclient.c:1224:2: error: use of undeclared identifier 'x'
           ASSERT(attr->ia_valid & ATTR_SIZE);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/fsclient.c:1266:2: error: use of undeclared identifier 'x'
           ASSERT(attr->ia_valid & ATTR_SIZE);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   2 errors generated.
--
>> fs/afs/fs_operation.c:138:2: error: use of undeclared identifier 'x'
           ASSERT(vnode);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/mntpt.c:224:2: error: use of undeclared identifier 'x'
           ASSERT(list_empty(&afs_vfsmounts));
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/rotate.c:398:2: error: use of undeclared identifier 'x'
           ASSERT(op->ac.alist);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/rxrpc.c:174:3: error: use of undeclared identifier 'x'
                   ASSERT(!work_pending(&call->async_work));
                   ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/rxrpc.c:175:3: error: use of undeclared identifier 'x'
                   ASSERT(call->type->name != NULL);
                   ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/rxrpc.c:371:2: error: use of undeclared identifier 'x'
           ASSERT(call->type != NULL);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   fs/afs/rxrpc.c:372:2: error: use of undeclared identifier 'x'
           ASSERT(call->type->name != NULL);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   4 errors generated.
--
>> fs/afs/server.c:671:2: error: use of undeclared identifier 'x'
           ASSERT(server);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.
--
>> fs/afs/vl_rotate.c:236:2: error: use of undeclared identifier 'x'
           ASSERT(vc->ac.alist);
           ^
   fs/afs/internal.h:1583:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X) ASSERT_FAIL(x)
                                 ^
   1 error generated.

# https://github.com/0day-ci/linux/commit/16d044e9c58d5bce6b15c15a2d4a06c32006837d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 16d044e9c58d5bce6b15c15a2d4a06c32006837d
vim +/x +179 fs/afs/callback.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  170  
^1da177e4c3f41 Linus Torvalds 2005-04-16  171  /*
^1da177e4c3f41 Linus Torvalds 2005-04-16  172   * allow the fileserver to break callback promises
^1da177e4c3f41 Linus Torvalds 2005-04-16  173   */
08e0e7c82eeade David Howells  2007-04-26  174  void afs_break_callbacks(struct afs_server *server, size_t count,
5cf9dd55a0ec26 David Howells  2018-04-09  175  			 struct afs_callback_break *callbacks)
^1da177e4c3f41 Linus Torvalds 2005-04-16  176  {
08e0e7c82eeade David Howells  2007-04-26  177  	_enter("%p,%zu,", server, count);
^1da177e4c3f41 Linus Torvalds 2005-04-16  178  
08e0e7c82eeade David Howells  2007-04-26 @179  	ASSERT(server != NULL);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35108 bytes --]

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

* Re: [PATCH 06/23] rxrpc: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
@ 2020-08-27 17:10   ` kernel test robot
  2020-08-27 18:03   ` kernel test robot
  2020-08-28  6:05   ` kernel test robot
  2 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-27 17:10 UTC (permalink / raw)
  To: Chunguang Xu, arnd; +Cc: kbuild-all, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5629 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master asm-generic/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from net/rxrpc/af_rxrpc.c:10:
   net/rxrpc/af_rxrpc.c: In function 'rxrpc_listen':
>> net/rxrpc/ar-internal.h:1184:31: error: 'x' undeclared (first use in this function); did you mean 'rx'?
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   net/rxrpc/ar-internal.h:1184:19: note: in expansion of macro 'ASSERT_FAIL'
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   net/rxrpc/af_rxrpc.c:226:3: note: in expansion of macro 'ASSERT'
     226 |   ASSERT(rx->local != NULL);
         |   ^~~~~~
   net/rxrpc/ar-internal.h:1184:31: note: each undeclared identifier is reported only once for each function it appears in
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   net/rxrpc/ar-internal.h:1184:19: note: in expansion of macro 'ASSERT_FAIL'
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   net/rxrpc/af_rxrpc.c:226:3: note: in expansion of macro 'ASSERT'
     226 |   ASSERT(rx->local != NULL);
         |   ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from net/rxrpc/call_accept.c:10:
   net/rxrpc/call_accept.c: In function 'rxrpc_accept_call':
>> net/rxrpc/ar-internal.h:1184:31: error: 'x' undeclared (first use in this function); did you mean 'rx'?
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   net/rxrpc/ar-internal.h:1184:19: note: in expansion of macro 'ASSERT_FAIL'
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   net/rxrpc/call_accept.c:479:2: note: in expansion of macro 'ASSERT'
     479 |  ASSERT(!irqs_disabled());
         |  ^~~~~~
   net/rxrpc/ar-internal.h:1184:31: note: each undeclared identifier is reported only once for each function it appears in
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   net/rxrpc/ar-internal.h:1184:19: note: in expansion of macro 'ASSERT_FAIL'
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   net/rxrpc/call_accept.c:479:2: note: in expansion of macro 'ASSERT'
     479 |  ASSERT(!irqs_disabled());
         |  ^~~~~~
   net/rxrpc/call_accept.c: In function 'rxrpc_reject_call':
>> net/rxrpc/ar-internal.h:1184:31: error: 'x' undeclared (first use in this function); did you mean 'rx'?
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   net/rxrpc/ar-internal.h:1184:19: note: in expansion of macro 'ASSERT_FAIL'
    1184 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   net/rxrpc/call_accept.c:602:2: note: in expansion of macro 'ASSERT'
     602 |  ASSERT(!irqs_disabled());
         |  ^~~~~~

# https://github.com/0day-ci/linux/commit/1d215ffa42c9e100fa23c485351acf9293936807
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 1d215ffa42c9e100fa23c485351acf9293936807
vim +1184 net/rxrpc/ar-internal.h

  1183	
> 1184	#define ASSERT(X)	ASSERT_FAIL(x)
  1185	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52700 bytes --]

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

* Re: [PATCH 06/23] rxrpc: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
  2020-08-27 17:10   ` kernel test robot
@ 2020-08-27 18:03   ` kernel test robot
  2020-08-28  6:05   ` kernel test robot
  2 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-27 18:03 UTC (permalink / raw)
  To: Chunguang Xu, arnd
  Cc: kbuild-all, clang-built-linux, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 7393 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master asm-generic/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a013-20200827 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   net/rxrpc/rxkad.c:344:33: warning: format specifies type 'unsigned short' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
           _leave(" = %d [set %hx]", ret, y);
                              ~~~         ^
                              %x
   net/rxrpc/ar-internal.h:1150:16: note: expanded from macro '_leave'
                   kleave(FMT,##__VA_ARGS__);              \
                          ~~~   ^~~~~~~~~~~
   net/rxrpc/ar-internal.h:1121:63: note: expanded from macro 'kleave'
   #define kleave(FMT,...) dbgprintk("<== %s()"FMT"",__func__ ,##__VA_ARGS__)
                                               ~~~               ^~~~~~~~~~~
   net/rxrpc/ar-internal.h:1118:46: note: expanded from macro 'dbgprintk'
           printk("[%-6.6s] "FMT"\n", current->comm ,##__VA_ARGS__)
                             ~~~                       ^~~~~~~~~~~
>> net/rxrpc/rxkad.c:930:2: error: use of undeclared identifier 'x'
           ASSERT(conn->server_key->payload.data[0] != NULL);
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/rxkad.c:930:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   1 warning and 2 errors generated.

# https://github.com/0day-ci/linux/commit/1d215ffa42c9e100fa23c485351acf9293936807
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 1d215ffa42c9e100fa23c485351acf9293936807
vim +/x +930 net/rxrpc/rxkad.c

17926a79320afa David Howells 2007-04-26  890  
17926a79320afa David Howells 2007-04-26  891  /*
17926a79320afa David Howells 2007-04-26  892   * decrypt the kerberos IV ticket in the response
17926a79320afa David Howells 2007-04-26  893   */
17926a79320afa David Howells 2007-04-26  894  static int rxkad_decrypt_ticket(struct rxrpc_connection *conn,
fb46f6ee10e787 David Howells 2017-04-06  895  				struct sk_buff *skb,
17926a79320afa David Howells 2007-04-26  896  				void *ticket, size_t ticket_len,
17926a79320afa David Howells 2007-04-26  897  				struct rxrpc_crypt *_session_key,
10674a03c63337 Baolin Wang   2017-08-29  898  				time64_t *_expiry,
17926a79320afa David Howells 2007-04-26  899  				u32 *_abort_code)
17926a79320afa David Howells 2007-04-26  900  {
1afe593b423918 Herbert Xu    2016-01-24  901  	struct skcipher_request *req;
fb46f6ee10e787 David Howells 2017-04-06  902  	struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
17926a79320afa David Howells 2007-04-26  903  	struct rxrpc_crypt iv, key;
68e3f5dd4db626 Herbert Xu    2007-10-27  904  	struct scatterlist sg[1];
17926a79320afa David Howells 2007-04-26  905  	struct in_addr addr;
95c961747284a6 Eric Dumazet  2012-04-15  906  	unsigned int life;
fb46f6ee10e787 David Howells 2017-04-06  907  	const char *eproto;
10674a03c63337 Baolin Wang   2017-08-29  908  	time64_t issue, now;
17926a79320afa David Howells 2007-04-26  909  	bool little_endian;
17926a79320afa David Howells 2007-04-26  910  	int ret;
fb46f6ee10e787 David Howells 2017-04-06  911  	u32 abort_code;
17926a79320afa David Howells 2007-04-26  912  	u8 *p, *q, *name, *end;
17926a79320afa David Howells 2007-04-26  913  
17926a79320afa David Howells 2007-04-26  914  	_enter("{%d},{%x}", conn->debug_id, key_serial(conn->server_key));
17926a79320afa David Howells 2007-04-26  915  
17926a79320afa David Howells 2007-04-26  916  	*_expiry = 0;
17926a79320afa David Howells 2007-04-26  917  
17926a79320afa David Howells 2007-04-26  918  	ret = key_validate(conn->server_key);
17926a79320afa David Howells 2007-04-26  919  	if (ret < 0) {
17926a79320afa David Howells 2007-04-26  920  		switch (ret) {
17926a79320afa David Howells 2007-04-26  921  		case -EKEYEXPIRED:
fb46f6ee10e787 David Howells 2017-04-06  922  			abort_code = RXKADEXPIRED;
ef68622da9cc0c David Howells 2017-04-06  923  			goto other_error;
17926a79320afa David Howells 2007-04-26  924  		default:
fb46f6ee10e787 David Howells 2017-04-06  925  			abort_code = RXKADNOAUTH;
ef68622da9cc0c David Howells 2017-04-06  926  			goto other_error;
17926a79320afa David Howells 2007-04-26  927  		}
17926a79320afa David Howells 2007-04-26  928  	}
17926a79320afa David Howells 2007-04-26  929  
146aa8b1453bd8 David Howells 2015-10-21 @930  	ASSERT(conn->server_key->payload.data[0] != NULL);
17926a79320afa David Howells 2007-04-26  931  	ASSERTCMP((unsigned long) ticket & 7UL, ==, 0);
17926a79320afa David Howells 2007-04-26  932  
146aa8b1453bd8 David Howells 2015-10-21  933  	memcpy(&iv, &conn->server_key->payload.data[2], sizeof(iv));
17926a79320afa David Howells 2007-04-26  934  
ef68622da9cc0c David Howells 2017-04-06  935  	ret = -ENOMEM;
1afe593b423918 Herbert Xu    2016-01-24  936  	req = skcipher_request_alloc(conn->server_key->payload.data[0],
1afe593b423918 Herbert Xu    2016-01-24  937  				     GFP_NOFS);
ef68622da9cc0c David Howells 2017-04-06  938  	if (!req)
ef68622da9cc0c David Howells 2017-04-06  939  		goto temporary_error;
17926a79320afa David Howells 2007-04-26  940  
68e3f5dd4db626 Herbert Xu    2007-10-27  941  	sg_init_one(&sg[0], ticket, ticket_len);
1afe593b423918 Herbert Xu    2016-01-24  942  	skcipher_request_set_callback(req, 0, NULL, NULL);
1afe593b423918 Herbert Xu    2016-01-24  943  	skcipher_request_set_crypt(req, sg, sg, ticket_len, iv.x);
1afe593b423918 Herbert Xu    2016-01-24  944  	crypto_skcipher_decrypt(req);
1afe593b423918 Herbert Xu    2016-01-24  945  	skcipher_request_free(req);
17926a79320afa David Howells 2007-04-26  946  
17926a79320afa David Howells 2007-04-26  947  	p = ticket;
17926a79320afa David Howells 2007-04-26  948  	end = p + ticket_len;
17926a79320afa David Howells 2007-04-26  949  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 35735 bytes --]

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

* Re: [PATCH 09/23] cachefiles: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 09/23] cachefiles: " Chunguang Xu
@ 2020-08-28  4:30   ` kernel test robot
  0 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-28  4:30 UTC (permalink / raw)
  To: Chunguang Xu, arnd; +Cc: kbuild-all, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 18769 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master asm-generic/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from fs/cachefiles/bind.c:8:
   fs/cachefiles/bind.c: In function 'cachefiles_daemon_bind':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/bind.c:39:2: note: in expansion of macro 'ASSERT'
      39 |  ASSERT(cache->fstop_percent >= 0 &&
         |  ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/bind.c:39:2: note: in expansion of macro 'ASSERT'
      39 |  ASSERT(cache->fstop_percent >= 0 &&
         |  ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from fs/cachefiles/daemon.c:8:
   fs/cachefiles/daemon.c: In function 'cachefiles_daemon_release':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/daemon.c:135:2: note: in expansion of macro 'ASSERT'
     135 |  ASSERT(cache);
         |  ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/daemon.c:135:2: note: in expansion of macro 'ASSERT'
     135 |  ASSERT(cache);
         |  ^~~~~~
   fs/cachefiles/daemon.c: In function 'cachefiles_daemon_write':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/daemon.c:223:2: note: in expansion of macro 'ASSERT'
     223 |  ASSERT(cache);
         |  ^~~~~~
--
   In file included from include/asm-generic/bug.h:5,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from fs/cachefiles/interface.c:8:
   fs/cachefiles/interface.c: In function 'cachefiles_drop_object':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/interface.c:269:2: note: in expansion of macro 'ASSERT'
     269 |  ASSERT(_object);
         |  ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/interface.c:269:2: note: in expansion of macro 'ASSERT'
     269 |  ASSERT(_object);
         |  ^~~~~~
   fs/cachefiles/interface.c: In function 'cachefiles_put_object':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/interface.c:329:2: note: in expansion of macro 'ASSERT'
     329 |  ASSERT(_object);
         |  ^~~~~~
   fs/cachefiles/interface.c: In function 'cachefiles_attr_changed':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/interface.c:455:2: note: in expansion of macro 'ASSERT'
     455 |  ASSERT(d_is_reg(object->backer));
         |  ^~~~~~
   fs/cachefiles/interface.c: In function 'cachefiles_invalidate_object':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/interface.c:518:3: note: in expansion of macro 'ASSERT'
     518 |   ASSERT(d_is_reg(object->backer));
         |   ^~~~~~
--
   In file included from include/asm-generic/bug.h:5,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from fs/cachefiles/key.c:8:
   fs/cachefiles/key.c: In function 'cachefiles_cook_key':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/key.c:107:4: note: in expansion of macro 'ASSERT'
     107 |    ASSERT(len < max);
         |    ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/key.c:107:4: note: in expansion of macro 'ASSERT'
     107 |    ASSERT(len < max);
         |    ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from fs/cachefiles/namei.c:8:
   fs/cachefiles/namei.c: In function 'cachefiles_mark_object_active':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/namei.c:163:3: note: in expansion of macro 'ASSERT'
     163 |   ASSERT(xobject != object);
         |   ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/namei.c:163:3: note: in expansion of macro 'ASSERT'
     163 |   ASSERT(xobject != object);
         |   ^~~~~~
   fs/cachefiles/namei.c: In function 'cachefiles_delete_object':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/namei.c:443:2: note: in expansion of macro 'ASSERT'
     443 |  ASSERT(object->dentry);
         |  ^~~~~~
   fs/cachefiles/namei.c: In function 'cachefiles_walk_to_object':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/namei.c:503:2: note: in expansion of macro 'ASSERT'
     503 |  ASSERT(parent->dentry);
         |  ^~~~~~
   fs/cachefiles/namei.c: In function 'cachefiles_get_directory':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/namei.c:802:3: note: in expansion of macro 'ASSERT'
     802 |   ASSERT(d_backing_inode(subdir));
         |   ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from include/linux/list.h:9,
                    from include/linux/module.h:12,
                    from fs/cachefiles/xattr.c:8:
   fs/cachefiles/xattr.c: In function 'cachefiles_check_object_type':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/xattr.c:31:2: note: in expansion of macro 'ASSERT'
      31 |  ASSERT(dentry);
         |  ^~~~~~
   fs/cachefiles/internal.h:319:31: note: each undeclared identifier is reported only once for each function it appears in
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/xattr.c:31:2: note: in expansion of macro 'ASSERT'
      31 |  ASSERT(dentry);
         |  ^~~~~~
   fs/cachefiles/xattr.c: In function 'cachefiles_set_object_xattr':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/xattr.c:105:2: note: in expansion of macro 'ASSERT'
     105 |  ASSERT(dentry);
         |  ^~~~~~
   fs/cachefiles/xattr.c: In function 'cachefiles_check_auxdata':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/xattr.c:166:2: note: in expansion of macro 'ASSERT'
     166 |  ASSERT(dentry);
         |  ^~~~~~
   fs/cachefiles/xattr.c: In function 'cachefiles_check_object_xattr':
>> fs/cachefiles/internal.h:319:31: error: 'x' undeclared (first use in this function)
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/cachefiles/internal.h:319:19: note: in expansion of macro 'ASSERT_FAIL'
     319 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/cachefiles/xattr.c:206:2: note: in expansion of macro 'ASSERT'
     206 |  ASSERT(dentry);
         |  ^~~~~~
..

# https://github.com/0day-ci/linux/commit/417c020454c51ba2275386ea2cce82645eb31164
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 417c020454c51ba2275386ea2cce82645eb31164
vim +/x +319 fs/cachefiles/internal.h

   318	
 > 319	#define ASSERT(X) ASSERT_FAIL(x)
   320	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52700 bytes --]

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

* Re: [PATCH 06/23] rxrpc: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
  2020-08-27 17:10   ` kernel test robot
  2020-08-27 18:03   ` kernel test robot
@ 2020-08-28  6:05   ` kernel test robot
  2 siblings, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-28  6:05 UTC (permalink / raw)
  To: Chunguang Xu, arnd
  Cc: kbuild-all, clang-built-linux, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 17090 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master asm-generic/master v5.9-rc2 next-20200827]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a015-20200827 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 71f3169e1baeff262583b35ef88f8fb6df7be85e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> net/rxrpc/af_rxrpc.c:226:3: error: use of undeclared identifier 'x'
                   ASSERT(rx->local != NULL);
                   ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/af_rxrpc.c:226:3: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   2 errors generated.
--
>> net/rxrpc/call_accept.c:479:2: error: use of undeclared identifier 'x'
           ASSERT(!irqs_disabled());
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/call_accept.c:479:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/call_accept.c:602:2: error: use of undeclared identifier 'x'
           ASSERT(!irqs_disabled());
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/call_accept.c:602:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   4 errors generated.
--
>> net/rxrpc/call_event.c:177:2: error: use of undeclared identifier 'x'
           ASSERT(before_eq(cursor, top));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/call_event.c:177:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   2 errors generated.
--
>> net/rxrpc/call_object.c:555:2: error: use of undeclared identifier 'x'
           ASSERT(call != NULL);
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/call_object.c:555:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/call_object.c:619:2: error: use of undeclared identifier 'x'
           ASSERT(test_bit(RXRPC_CALL_RELEASED, &call->flags));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/call_object.c:619:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   4 errors generated.
--
>> net/rxrpc/conn_client.c:811:3: error: use of undeclared identifier 'x'
                   ASSERT(!test_bit(RXRPC_CALL_EXPOSED, &call->flags));
                   ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/conn_client.c:811:3: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:901:3: error: use of undeclared identifier 'x'
                   ASSERT(list_empty(&conn->waiting_calls));
                   ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:901:3: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:1034:3: error: use of undeclared identifier 'x'
                   ASSERT(!list_empty(&rxnet->active_client_conns));
                   ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:1034:3: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:1101:2: error: use of undeclared identifier 'x'
           ASSERT(test_bit(RXRPC_CONN_EXPOSED, &conn->flags));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_client.c:1101:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   8 errors generated.
--
>> net/rxrpc/conn_event.c:377:2: error: use of undeclared identifier 'x'
           ASSERT(conn->security_ix != 0);
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/conn_event.c:377:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_event.c:378:2: error: use of undeclared identifier 'x'
           ASSERT(conn->server_key);
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_event.c:378:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   4 errors generated.
--
>> net/rxrpc/conn_object.c:239:2: error: use of undeclared identifier 'x'
           ASSERT(!rcu_access_pointer(conn->channels[0].call) &&
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/conn_object.c:239:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:243:2: error: use of undeclared identifier 'x'
           ASSERT(list_empty(&conn->cache_link));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:243:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:438:3: error: use of undeclared identifier 'x'
                   ASSERT(time_after(earliest, now));
                   ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:438:3: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:481:2: error: use of undeclared identifier 'x'
           ASSERT(list_empty(&rxnet->conn_proc_list));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/conn_object.c:481:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   8 errors generated.
--
>> net/rxrpc/input.c:262:2: error: use of undeclared identifier 'x'
           ASSERT(test_bit(RXRPC_CALL_TX_LAST, &call->flags));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/input.c:262:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   2 errors generated.
--
>> net/rxrpc/local_object.c:401:2: error: use of undeclared identifier 'x'
           ASSERT(!local->service);
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/local_object.c:401:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/local_object.c:462:2: error: use of undeclared identifier 'x'
           ASSERT(!work_pending(&local->processor));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   net/rxrpc/local_object.c:462:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   4 errors generated.
--
>> net/rxrpc/peer_event.c:397:2: error: use of undeclared identifier 'x'
           ASSERT(list_empty(&collector));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/peer_event.c:397:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   2 errors generated.
--
>> net/rxrpc/peer_object.c:416:2: error: use of undeclared identifier 'x'
           ASSERT(hlist_empty(&peer->error_targets));
           ^
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
>> net/rxrpc/peer_object.c:416:2: error: use of undeclared identifier 'x'
   net/rxrpc/ar-internal.h:1184:31: note: expanded from macro 'ASSERT'
   #define ASSERT(X)       ASSERT_FAIL(x)
                                       ^
   2 errors generated.
..

# https://github.com/0day-ci/linux/commit/1d215ffa42c9e100fa23c485351acf9293936807
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 1d215ffa42c9e100fa23c485351acf9293936807
vim +/x +226 net/rxrpc/af_rxrpc.c

17926a79320afa9 David Howells       2007-04-26  205  
17926a79320afa9 David Howells       2007-04-26  206  /*
17926a79320afa9 David Howells       2007-04-26  207   * set the number of pending calls permitted on a listening socket
17926a79320afa9 David Howells       2007-04-26  208   */
17926a79320afa9 David Howells       2007-04-26  209  static int rxrpc_listen(struct socket *sock, int backlog)
17926a79320afa9 David Howells       2007-04-26  210  {
17926a79320afa9 David Howells       2007-04-26  211  	struct sock *sk = sock->sk;
17926a79320afa9 David Howells       2007-04-26  212  	struct rxrpc_sock *rx = rxrpc_sk(sk);
00e907127e6f86d David Howells       2016-09-08  213  	unsigned int max, old;
17926a79320afa9 David Howells       2007-04-26  214  	int ret;
17926a79320afa9 David Howells       2007-04-26  215  
17926a79320afa9 David Howells       2007-04-26  216  	_enter("%p,%d", rx, backlog);
17926a79320afa9 David Howells       2007-04-26  217  
17926a79320afa9 David Howells       2007-04-26  218  	lock_sock(&rx->sk);
17926a79320afa9 David Howells       2007-04-26  219  
17926a79320afa9 David Howells       2007-04-26  220  	switch (rx->sk.sk_state) {
2341e0775747864 David Howells       2016-06-09  221  	case RXRPC_UNBOUND:
17926a79320afa9 David Howells       2007-04-26  222  		ret = -EADDRNOTAVAIL;
17926a79320afa9 David Howells       2007-04-26  223  		break;
17926a79320afa9 David Howells       2007-04-26  224  	case RXRPC_SERVER_BOUND:
28036f44851e251 David Howells       2017-06-05  225  	case RXRPC_SERVER_BOUND2:
17926a79320afa9 David Howells       2007-04-26 @226  		ASSERT(rx->local != NULL);
0e119b41b7f23e0 David Howells       2016-06-10  227  		max = READ_ONCE(rxrpc_max_backlog);
0e119b41b7f23e0 David Howells       2016-06-10  228  		ret = -EINVAL;
0e119b41b7f23e0 David Howells       2016-06-10  229  		if (backlog == INT_MAX)
0e119b41b7f23e0 David Howells       2016-06-10  230  			backlog = max;
0e119b41b7f23e0 David Howells       2016-06-10  231  		else if (backlog < 0 || backlog > max)
0e119b41b7f23e0 David Howells       2016-06-10  232  			break;
00e907127e6f86d David Howells       2016-09-08  233  		old = sk->sk_max_ack_backlog;
17926a79320afa9 David Howells       2007-04-26  234  		sk->sk_max_ack_backlog = backlog;
00e907127e6f86d David Howells       2016-09-08  235  		ret = rxrpc_service_prealloc(rx, GFP_KERNEL);
00e907127e6f86d David Howells       2016-09-08  236  		if (ret == 0)
17926a79320afa9 David Howells       2007-04-26  237  			rx->sk.sk_state = RXRPC_SERVER_LISTENING;
00e907127e6f86d David Howells       2016-09-08  238  		else
00e907127e6f86d David Howells       2016-09-08  239  			sk->sk_max_ack_backlog = old;
17926a79320afa9 David Howells       2007-04-26  240  		break;
210f035316f545e David Howells       2017-01-05  241  	case RXRPC_SERVER_LISTENING:
210f035316f545e David Howells       2017-01-05  242  		if (backlog == 0) {
210f035316f545e David Howells       2017-01-05  243  			rx->sk.sk_state = RXRPC_SERVER_LISTEN_DISABLED;
210f035316f545e David Howells       2017-01-05  244  			sk->sk_max_ack_backlog = 0;
210f035316f545e David Howells       2017-01-05  245  			rxrpc_discard_prealloc(rx);
210f035316f545e David Howells       2017-01-05  246  			ret = 0;
210f035316f545e David Howells       2017-01-05  247  			break;
210f035316f545e David Howells       2017-01-05  248  		}
e3cf39706b89001 Gustavo A. R. Silva 2017-10-19  249  		/* Fall through */
0e119b41b7f23e0 David Howells       2016-06-10  250  	default:
0e119b41b7f23e0 David Howells       2016-06-10  251  		ret = -EBUSY;
0e119b41b7f23e0 David Howells       2016-06-10  252  		break;
17926a79320afa9 David Howells       2007-04-26  253  	}
17926a79320afa9 David Howells       2007-04-26  254  
17926a79320afa9 David Howells       2007-04-26  255  	release_sock(&rx->sk);
17926a79320afa9 David Howells       2007-04-26  256  	_leave(" = %d", ret);
17926a79320afa9 David Howells       2007-04-26  257  	return ret;
17926a79320afa9 David Howells       2007-04-26  258  }
17926a79320afa9 David Howells       2007-04-26  259  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 41472 bytes --]

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

* Re: [PATCH 11/23] afs: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code
  2020-08-27 10:14 ` [PATCH 11/23] afs: " Chunguang Xu
  2020-08-27 16:29   ` kernel test robot
@ 2020-08-28  9:49   ` kernel test robot
  1 sibling, 0 replies; 31+ messages in thread
From: kernel test robot @ 2020-08-28  9:49 UTC (permalink / raw)
  To: Chunguang Xu, arnd; +Cc: kbuild-all, rppt, linux-arch, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 18363 bytes --]

Hi Chunguang,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkp-scsi/for-next]
[also build test ERROR on scsi/for-next block/for-next linus/master v5.9-rc2 next-20200827]
[cannot apply to asm-generic/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/kernel.h:11,
                    from fs/afs/file.c:8:
   fs/afs/file.c: In function 'afs_readpage':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/file.c:398:3: note: in expansion of macro 'ASSERT'
     398 |   ASSERT(key != NULL);
         |   ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/file.c:398:3: note: in expansion of macro 'ASSERT'
     398 |   ASSERT(key != NULL);
         |   ^~~~~~
   fs/afs/file.c: In function 'afs_readpages':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/file.c:553:2: note: in expansion of macro 'ASSERT'
     553 |  ASSERT(key != NULL);
         |  ^~~~~~
--
   In file included from fs/afs/internal.h:8,
                    from fs/afs/flock.c:8:
   fs/afs/flock.c: In function 'afs_lock_work':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/flock.c:326:3: note: in expansion of macro 'ASSERT'
     326 |   ASSERT(!list_empty(&vnode->granted_locks));
         |   ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/flock.c:326:3: note: in expansion of macro 'ASSERT'
     326 |   ASSERT(!list_empty(&vnode->granted_locks));
         |   ^~~~~~
   fs/afs/flock.c: In function 'afs_do_setlk':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/flock.c:591:3: note: in expansion of macro 'ASSERT'
     591 |   ASSERT(list_empty(&vnode->granted_locks));
         |   ^~~~~~
--
   In file included from include/linux/init.h:5,
                    from fs/afs/fsclient.c:8:
   fs/afs/fsclient.c: In function 'afs_fs_setattr_size64':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/fsclient.c:1224:2: note: in expansion of macro 'ASSERT'
    1224 |  ASSERT(attr->ia_valid & ATTR_SIZE);
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/fsclient.c:1224:2: note: in expansion of macro 'ASSERT'
    1224 |  ASSERT(attr->ia_valid & ATTR_SIZE);
         |  ^~~~~~
   fs/afs/fsclient.c: In function 'afs_fs_setattr_size':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/fsclient.c:1266:2: note: in expansion of macro 'ASSERT'
    1266 |  ASSERT(attr->ia_valid & ATTR_SIZE);
         |  ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from fs/afs/fs_operation.c:8:
   fs/afs/fs_operation.c: In function 'afs_begin_vnode_operation':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/fs_operation.c:138:2: note: in expansion of macro 'ASSERT'
     138 |  ASSERT(vnode);
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/fs_operation.c:138:2: note: in expansion of macro 'ASSERT'
     138 |  ASSERT(vnode);
         |  ^~~~~~
   fs/afs/fs_operation.c:136:20: warning: unused variable 'vnode' [-Wunused-variable]
     136 |  struct afs_vnode *vnode = op->file[0].vnode;
         |                    ^~~~~
--
   In file included from include/linux/kernel.h:11,
                    from fs/afs/mntpt.c:8:
   fs/afs/mntpt.c: In function 'afs_mntpt_kill_timer':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/mntpt.c:224:2: note: in expansion of macro 'ASSERT'
     224 |  ASSERT(list_empty(&afs_vfsmounts));
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/mntpt.c:224:2: note: in expansion of macro 'ASSERT'
     224 |  ASSERT(list_empty(&afs_vfsmounts));
         |  ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from fs/afs/rotate.c:8:
   fs/afs/rotate.c: In function 'afs_select_fileserver':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/rotate.c:398:2: note: in expansion of macro 'ASSERT'
     398 |  ASSERT(op->ac.alist);
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/rotate.c:398:2: note: in expansion of macro 'ASSERT'
     398 |  ASSERT(op->ac.alist);
         |  ^~~~~~
--
   In file included from include/asm-generic/bug.h:5,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:15,
                    from fs/afs/rxrpc.c:8:
   fs/afs/rxrpc.c: In function 'afs_put_call':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/rxrpc.c:174:3: note: in expansion of macro 'ASSERT'
     174 |   ASSERT(!work_pending(&call->async_work));
         |   ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/rxrpc.c:174:3: note: in expansion of macro 'ASSERT'
     174 |   ASSERT(!work_pending(&call->async_work));
         |   ^~~~~~
   fs/afs/rxrpc.c: In function 'afs_make_call':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/rxrpc.c:371:2: note: in expansion of macro 'ASSERT'
     371 |  ASSERT(call->type != NULL);
         |  ^~~~~~
--
   In file included from include/asm-generic/bug.h:5,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/sh/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from fs/afs/server.c:8:
   fs/afs/server.c: In function 'afs_check_server_record':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/server.c:671:2: note: in expansion of macro 'ASSERT'
     671 |  ASSERT(server);
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/server.c:671:2: note: in expansion of macro 'ASSERT'
     671 |  ASSERT(server);
         |  ^~~~~~
--
   In file included from include/linux/kernel.h:11,
                    from fs/afs/callback.c:16:
   fs/afs/callback.c: In function 'afs_break_callbacks':
>> fs/afs/internal.h:1583:31: error: 'x' undeclared (first use in this function)
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/callback.c:179:2: note: in expansion of macro 'ASSERT'
     179 |  ASSERT(server != NULL);
         |  ^~~~~~
   fs/afs/internal.h:1583:31: note: each undeclared identifier is reported only once for each function it appears in
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                               ^
   include/linux/compiler.h:78:42: note: in definition of macro 'unlikely'
      78 | # define unlikely(x) __builtin_expect(!!(x), 0)
         |                                          ^
   fs/afs/internal.h:1583:19: note: in expansion of macro 'ASSERT_FAIL'
    1583 | #define ASSERT(X) ASSERT_FAIL(x)
         |                   ^~~~~~~~~~~
   fs/afs/callback.c:179:2: note: in expansion of macro 'ASSERT'
     179 |  ASSERT(server != NULL);
         |  ^~~~~~
..

# https://github.com/0day-ci/linux/commit/16d044e9c58d5bce6b15c15a2d4a06c32006837d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Chunguang-Xu/clean-up-the-code-related-to-ASSERT/20200827-182148
git checkout 16d044e9c58d5bce6b15c15a2d4a06c32006837d
vim +/x +1583 fs/afs/internal.h

  1582	
> 1583	#define ASSERT(X) ASSERT_FAIL(x)
  1584	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52700 bytes --]

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

end of thread, other threads:[~2020-08-28 10:39 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 10:14 [PATCH 00/23] clean up the code related to ASSERT() Chunguang Xu
2020-08-27 10:14 ` [PATCH 01/23] include/asm-generic/bug.h: add ASSERT_FAIL() and ASSERT_WARN() wrapper Chunguang Xu
2020-08-27 10:14 ` [PATCH 02/23] ia64: use ASSERT_FAIL()/ASSERT_WARN() to cleanup some code Chunguang Xu
2020-08-27 10:14 ` [PATCH 03/23] KVM: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 04/23] fore200e: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 05/23] scsi: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 06/23] rxrpc: " Chunguang Xu
2020-08-27 17:10   ` kernel test robot
2020-08-27 18:03   ` kernel test robot
2020-08-28  6:05   ` kernel test robot
2020-08-27 10:14 ` [PATCH 07/23] lib/mpi: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 08/23] jfs: " Chunguang Xu
2020-08-27 16:13   ` kernel test robot
2020-08-27 10:14 ` [PATCH 09/23] cachefiles: " Chunguang Xu
2020-08-28  4:30   ` kernel test robot
2020-08-27 10:14 ` [PATCH 10/23] btrfs: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 11/23] afs: " Chunguang Xu
2020-08-27 16:29   ` kernel test robot
2020-08-28  9:49   ` kernel test robot
2020-08-27 10:14 ` [PATCH 12/23] rivafb: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 13/23] nvidia: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 14/23] fbdev/cirrusfb:: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 15/23] media/staging: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 16/23] sym53c8xx: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 17/23] 8139too: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 18/23] net:hns: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 19/23] block/sx8: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 20/23] skb: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 21/23] ext4: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 22/23] rbd: " Chunguang Xu
2020-08-27 10:14 ` [PATCH 23/23] ALSA: asihpi: " Chunguang Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).