All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ceph: use BUG() instead of BUG_ON(1)
@ 2017-01-16 11:06 Arnd Bergmann
  2017-01-16 13:33 ` Ilya Dryomov
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2017-01-16 11:06 UTC (permalink / raw)
  To: Ilya Dryomov, Yan, Zheng, Sage Weil
  Cc: Arnd Bergmann, ceph-devel, linux-kernel

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

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

* Re: [PATCH] ceph: use BUG() instead of BUG_ON(1)
  2017-01-16 11:06 [PATCH] ceph: use BUG() instead of BUG_ON(1) Arnd Bergmann
@ 2017-01-16 13:33 ` Ilya Dryomov
  0 siblings, 0 replies; 2+ messages in thread
From: Ilya Dryomov @ 2017-01-16 13:33 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Yan, Zheng, Sage Weil, Ceph Development, linux-kernel

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

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

end of thread, other threads:[~2017-01-16 13:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-16 11:06 [PATCH] ceph: use BUG() instead of BUG_ON(1) Arnd Bergmann
2017-01-16 13:33 ` Ilya Dryomov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.