[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Wed, 4 Apr 2018 14:54:05 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Ilya Dryomov <idryomov@...il.com>
Cc: Sage Weil <sage@...hat.com>, Alex Elder <elder@...nel.org>,
Jens Axboe <axboe@...nel.dk>,
Jason Dillaman <dillaman@...hat.com>,
Ceph Development <ceph-devel@...r.kernel.org>,
linux-block <linux-block@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] rbd: add missing return statements
On Wed, Apr 4, 2018 at 1:04 PM, Ilya Dryomov <idryomov@...il.com> wrote:
> On Wed, Apr 4, 2018 at 11:49 AM, Arnd Bergmann <arnd@...db.de> wrote:
>> A new set of warnings appeared in next-20180403 in some configurations
>> when gcc cannot see that rbd_assert(0) leads to an unreachable code
>> path:
>>
>> drivers/block/rbd.c: In function 'rbd_img_is_write':
>> drivers/block/rbd.c:1397:1: error: control reaches end of non-void function [-Werror=return-type]
>> drivers/block/rbd.c: In function '__rbd_obj_handle_request':
>> drivers/block/rbd.c:2499:1: error: control reaches end of non-void function [-Werror=return-type]
>> drivers/block/rbd.c: In function 'rbd_obj_handle_write':
>> drivers/block/rbd.c:2471:1: error: control reaches end of non-void function [-Werror=return-type]
>>
>> To work around this, we can add a return statement to each of these
>> cases. An alternative would be to remove the unlikely() annotation
>> in rbd_assert(), or to just use BUG()/BUG_ON() directly. This adds the
>> return statements, guessing what the most reasonable behavior
>> would be.
>
> Hi Arnd,
>
> I don't like these bogus return statements. Let's go with explicit
> BUG/BUG_ON() instead.
Sounds good. Sent a v2 now.
Arnd
Powered by blists - more mailing lists