Received: by 10.213.65.68 with SMTP id h4csp719197imn; Wed, 4 Apr 2018 06:11:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/ndkARNG/iUElSXJx8VM+vHi3w9WvdxA9bjaH9Reh6IwGnAA+OcqC7GRNEQV9+Z1vl2mbd X-Received: by 2002:a17:902:468:: with SMTP id 95-v6mr18796852ple.360.1522847517211; Wed, 04 Apr 2018 06:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522847517; cv=none; d=google.com; s=arc-20160816; b=0EseQmzdN2Kd8p5vNHX9UR4eP+knw7XBV9Zmozh4zGg5Z+NZ67U52ZNpFgeqk6Oyuo 82XJLkodXgmwR5a7g2nLX1/aPg0t/pgDTT8zggEW0f4XBvn5EbiPihZG/uDGILJRB6TY moQXeLfpnJiR4IH1Hh4/zGLlA80/IzrMNyNJeecOCBMMtCee1+ZRinilu0ILtCkHYxdy YxxtYHDBSLOhBkncNqY3bOtAC2gAfbgEIkKNI+Wvxr+/HCE4aBQEN8FTzqBjFXr64RxH G0MPA40W1N5bOu9h52NWlHbjnldHUK/1DMsZ9kTw0wV91ocHOTrj6BOaZVHEKjvyBZT0 StdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=WWU3zRKCYIAYYw2Gz8mvfflPN+r0YobYO7Xx4HDy+YU=; b=O48FKLcf7jc8K7D00wAXCcQYvfLreosTJSxi4rpsu/AihXRLNSpjf34DOk6zWhoCmY vu1XiJ9+ANQ8EV4WeFzUnu5Q8nRUYiIyhRGHIIfjxXsiLEus0CYJiGcJO2ruUoEzlU8N gL/nRaxZxxj5PZCHKBwKCqparj/4OkGMG5f4jgA8KF60XfLXzPUml5GjeldgZXSS9Gct 7JFZVBu24zPktkIGl+hIv8JlP6RLdbXItNUAcS8ir1ISA3nkE3gcMnshrPOY8m8eEyye POylSjmhY8bwTAF7Wx0JrXQG9uPjJIfIwz/k6zMOoEM8TcxPe9dBu4LxgPmC/tmP9zhJ hlkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LJR7p636; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 32-v6si5466018pla.348.2018.04.04.06.11.43; Wed, 04 Apr 2018 06:11:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LJR7p636; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751265AbeDDNK3 (ORCPT + 99 others); Wed, 4 Apr 2018 09:10:29 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:35148 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750842AbeDDNK1 (ORCPT ); Wed, 4 Apr 2018 09:10:27 -0400 Received: by mail-io0-f195.google.com with SMTP id x77so20017369ioi.2; Wed, 04 Apr 2018 06:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WWU3zRKCYIAYYw2Gz8mvfflPN+r0YobYO7Xx4HDy+YU=; b=LJR7p636qsuby1q2KYzhAVqjqX/vIemfme6elx0yA/6T3xErVvZKU5J1+axPIhL4b+ i0ezg4Oo25vV9jOUgoQx0A2YzDpjAqgokIkAp77Sfuor1EPiNhWoGbOZozYSUon4RJrY NgjkfEGsl8xXwMTTRH20nZZN/HdcMhVTzkqxwhF9PHsqN+PgOxEtNfAwf5HwBIluxLTs L2hMXu4MHypX4prKyVh1TQbSaszSLgkY5pDCWAmOPZyMLri3bVs8yP7X2j62/JQ4MDqi byD8K9ld95hMk652HbeUHk5729y1EaJs+ObU/XkDqyWLhQLoXS+u0Pw3+VUIOo4raJwP OzxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WWU3zRKCYIAYYw2Gz8mvfflPN+r0YobYO7Xx4HDy+YU=; b=FCeosLqpejjVp3ix6RHsCxNuN9rWhMG1b6CEVNG2ObJy5FGX2n3LoxwVpSSOWhdd2z KBRjr12KGmIXd6BH1w8pYP0QODyg0GJaZ7+7pku2Wjk9MO3aCVOwDjbVCr0gu+HujY3j ZWyoTNinMgKWkNxOoq5t7XT8iPfuR+EzM1movHFVrQq7Oc4n9EEl5E/nOqxUp5pg2Vu/ EZA6Ji9/kbe5O2ZDSYyHzAa5V2GtkGU9Dl3u3nH6uZQpoYwEj6PNc8GJvqyIcYDlBFf+ lf7nGxMlUk0UiBQNMMzzTAfyhRp/b2GxWNmjJbLOUQoJ73sYJxRgZshDhZlqtsmOIEBW pfiA== X-Gm-Message-State: ALQs6tAtqd7sI7liUcxgN6Ssu9lmMz9o5C8t6ic1m83jpCo/Nf4WIDnw nzvb/CWfDM1r33MKj56jfM1mVAyX3OoAOUwzgsIi3JzD X-Received: by 10.107.132.197 with SMTP id o66mr15910901ioi.119.1522847426841; Wed, 04 Apr 2018 06:10:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.180.251 with HTTP; Wed, 4 Apr 2018 06:10:26 -0700 (PDT) In-Reply-To: <20180404125345.4008862-1-arnd@arndb.de> References: <20180404125345.4008862-1-arnd@arndb.de> From: Ilya Dryomov Date: Wed, 4 Apr 2018 15:10:26 +0200 Message-ID: Subject: Re: [PATCH] [v2] rbd: avoid Wreturn-type warnings To: Arnd Bergmann Cc: Sage Weil , Alex Elder , Jens Axboe , Jason Dillaman , Ceph Development , linux-block , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 4, 2018 at 2:53 PM, Arnd Bergmann 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] > > As the rbd_assert() here shows has no extra information beyond the verbose > BUG(), we can simply use BUG() directly in its place. This is reliably > detected as not returning on any architecture, since it doesn't depend > on the unlikely() comparison that confused gcc. > > Fixes: 3da691bf4366 ("rbd: new request handling code") > Signed-off-by: Arnd Bergmann > --- > drivers/block/rbd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c > index 07dc5419bd63..5f7f4d4b78a8 100644 > --- a/drivers/block/rbd.c > +++ b/drivers/block/rbd.c > @@ -1392,7 +1392,7 @@ static bool rbd_img_is_write(struct rbd_img_request *img_req) > case OBJ_OP_DISCARD: > return true; > default: > - rbd_assert(0); > + BUG(); > } > } > > @@ -2466,7 +2466,7 @@ static bool rbd_obj_handle_write(struct rbd_obj_request *obj_req) > } > return false; > default: > - rbd_assert(0); > + BUG(); > } > } > > @@ -2494,7 +2494,7 @@ static bool __rbd_obj_handle_request(struct rbd_obj_request *obj_req) > } > return false; > default: > - rbd_assert(0); > + BUG(); > } > } > Applied. Thanks, Ilya