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


Groups > linux.kernel > #1559642 > unrolled thread

[PATCH] ceph: use BUG() instead of BUG_ON(1)

Started byArnd Bergmann <arnd@arndb.de>
First post2017-01-16 12:10 +0100
Last post2017-01-16 14:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ceph: use BUG() instead of BUG_ON(1) Arnd Bergmann <arnd@arndb.de> - 2017-01-16 12:10 +0100
    Re: [PATCH] ceph: use BUG() instead of BUG_ON(1) Ilya Dryomov <idryomov@gmail.com> - 2017-01-16 14:40 +0100

#1559642 — [PATCH] ceph: use BUG() instead of BUG_ON(1)

FromArnd Bergmann <arnd@arndb.de>
Date2017-01-16 12:10 +0100
Subject[PATCH] ceph: use BUG() instead of BUG_ON(1)
Message-ID<t0dkL-817-35@gated-at.bofh.it>
I ran into this compile warning, which is the result of BUG_ON(1)
not always leading to the compiler treating the code path as
unreachable:

include/linux/ceph/osdmap.h: In function 'ceph_can_shift_osds':
include/linux/ceph/osdmap.h:62:1: error: control reaches end of non-void function [-Werror=return-type]

Using BUG() here avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 include/linux/ceph/osdmap.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
index 9a9041784dcf..412906609954 100644
--- a/include/linux/ceph/osdmap.h
+++ b/include/linux/ceph/osdmap.h
@@ -57,7 +57,7 @@ static inline bool ceph_can_shift_osds(struct ceph_pg_pool_info *pool)
 	case CEPH_POOL_TYPE_EC:
 		return false;
 	default:
-		BUG_ON(1);
+		BUG();
 	}
 }
 
-- 
2.9.0

[toc] | [next] | [standalone]


#1559741

FromIlya Dryomov <idryomov@gmail.com>
Date2017-01-16 14:40 +0100
Message-ID<t0fFU-10y-29@gated-at.bofh.it>
In reply to#1559642
On Mon, Jan 16, 2017 at 12:06 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> I ran into this compile warning, which is the result of BUG_ON(1)
> not always leading to the compiler treating the code path as
> unreachable:
>
> include/linux/ceph/osdmap.h: In function 'ceph_can_shift_osds':
> include/linux/ceph/osdmap.h:62:1: error: control reaches end of non-void function [-Werror=return-type]
>
> Using BUG() here avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  include/linux/ceph/osdmap.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/ceph/osdmap.h b/include/linux/ceph/osdmap.h
> index 9a9041784dcf..412906609954 100644
> --- a/include/linux/ceph/osdmap.h
> +++ b/include/linux/ceph/osdmap.h
> @@ -57,7 +57,7 @@ static inline bool ceph_can_shift_osds(struct ceph_pg_pool_info *pool)
>         case CEPH_POOL_TYPE_EC:
>                 return false;
>         default:
> -               BUG_ON(1);
> +               BUG();
>         }
>  }

Applied.

Thanks,

                Ilya

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web