Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp957025ybm; Wed, 22 May 2019 14:38:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxTCjGMoekE/SUm6Twi4/YNfwQ/7RM4/VcCRlGd93fRbRygRdWVoUcsyQ4MUejt+nmjr5Ts X-Received: by 2002:a62:450e:: with SMTP id s14mr82892142pfa.255.1558561122480; Wed, 22 May 2019 14:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558561122; cv=none; d=google.com; s=arc-20160816; b=EBVORXWmjepGHYE7f6BIOaGtgjfEdNZKfgGeeRNq1AUFZ8Fo798MYT9tsAFNBxHZIh PBSrMn2Kmz07L638bSpCxEnxS8GHNmjWY1eGcaR5ApvYx5vTAyefE83dgm2pl/nrsJnx EfmKDTBEZ6tmuiDBuCMJroQ02io3be+8Obaa4tDHUHwY1CtgtMJiRL3eTafGJoeGH5KR cu7CyYhELwoYbu+4blT7F4sNUlwMSFO57mEBF+vWN+NwJoGlC8/lN4cV8b00T0feFYY8 OdivJ1FZ7JD8vMLSDj74+rpbkj+WBWH38qriy7F5n8HnBCV/rsjPYOPpOkcIwenTw4gb d2VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Fy14sO4rchyOLqtbo7A76SkiohfFXUWoNXMkDVmUGno=; b=FhB+T3bWaFcaW4VejWpGiZ4XIHq22GbCUIeXPgrZX4mmLRMDAFVlfQsHiWI24YHkTW XYZ28opYNEo1Uy5Y4oyOUI/IQxF9N3CjftY0if+1ak2D5A/czw564rGGjub51OMyzykC N6bKTjjqyVGhd/3elh/RLeF3+MxsqIO7S2sf0qAYGuJeCC1Mmx3ulcE4a79lE0gvZS5p RrIGLS0GknN67g9phV7U7MQB6NBW+ZtIawv1XNYO4R6lXvwH75W8BrZh8/mHBpTGOWhy yeLozNine12vY+4FbK7kAZm9kifIDE8WhZqe1xrm8qL5IMj6bszfXBmorvjNhrDunO9/ ru3A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si26321726pla.161.2019.05.22.14.38.26; Wed, 22 May 2019 14:38:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729898AbfEVVhL convert rfc822-to-8bit (ORCPT + 99 others); Wed, 22 May 2019 17:37:11 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:58152 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729691AbfEVVhK (ORCPT ); Wed, 22 May 2019 17:37:10 -0400 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:b93f:9fae:b276:a89a]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id A0C6F283655; Wed, 22 May 2019 22:37:08 +0100 (BST) Date: Wed, 22 May 2019 23:37:05 +0200 From: Boris Brezillon To: "Gustavo A. R. Silva" Cc: Kyungmin Park , Miquel Raynal , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Vignesh Raghavendra , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Kees Cook Subject: Re: [PATCH] mtd: onenand_base: Avoid fall-through warnings Message-ID: <20190522233705.234d75d5@collabora.com> In-Reply-To: <20190522180446.GA30082@embeddedor> References: <20190522180446.GA30082@embeddedor> Organization: Collabora X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 22 May 2019 13:04:46 -0500 "Gustavo A. R. Silva" wrote: > NOTICE THAT: > > "...we don't know whether we need fallthroughs or breaks there and this > is just a change to avoid having new warnings when switching to > -Wimplicit-fallthrough but this change might be entirely wrong."[1] > > See the original thread of discussion here: > > https://lore.kernel.org/patchwork/patch/1036251/ > > So, in preparation to enabling -Wimplicit-fallthrough, this patch silences > the following warnings: > > drivers/mtd/nand/onenand/onenand_base.c: In function ‘onenand_check_features’: > drivers/mtd/nand/onenand/onenand_base.c:3264:6: warning: this statement may fall through [-Wimplicit-fallthrough=] > if (ONENAND_IS_DDP(this)) > ^ > drivers/mtd/nand/onenand/onenand_base.c:3284:2: note: here > case ONENAND_DEVICE_DENSITY_2Gb: > ^~~~ > drivers/mtd/nand/onenand/onenand_base.c:3288:17: warning: this statement may fall through [-Wimplicit-fallthrough=] > this->options |= ONENAND_HAS_UNLOCK_ALL; > drivers/mtd/nand/onenand/onenand_base.c:3290:2: note: here > case ONENAND_DEVICE_DENSITY_1Gb: > ^~~~ > > Warning level 3 was used: -Wimplicit-fallthrough=3 > > This patch is part of the ongoing efforts to enable > -Wimplicit-fallthrough. > > [1] https://lore.kernel.org/lkml/20190509085318.34a9d4be@xps13/ > > Cc: Miquel Raynal > Signed-off-by: Gustavo A. R. Silva > --- > drivers/mtd/nand/onenand/onenand_base.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/mtd/nand/onenand/onenand_base.c b/drivers/mtd/nand/onenand/onenand_base.c > index f41d76248550..6cf4df9f8c01 100644 > --- a/drivers/mtd/nand/onenand/onenand_base.c > +++ b/drivers/mtd/nand/onenand/onenand_base.c > @@ -3280,12 +3280,14 @@ static void onenand_check_features(struct mtd_info *mtd) > if ((this->version_id & 0xf) == 0xe) > this->options |= ONENAND_HAS_NOP_1; > } > + /* Fall through - ? */ So, the only thing that you'll re-use by falling through the next case is the '->options |= ONENAND_HAS_UNLOCK_ALL' operation. I find it easier to follow with an explicit copy of this line + a break. > > case ONENAND_DEVICE_DENSITY_2Gb: > /* 2Gb DDP does not have 2 plane */ > if (!ONENAND_IS_DDP(this)) > this->options |= ONENAND_HAS_2PLANE; > this->options |= ONENAND_HAS_UNLOCK_ALL; > + /* Fall through - ? */ This fall through certainly doesn't make sense, as the only thing that might be done in the 1Gb case is conditionally adding the HAS_UNLOCK_ALL flag, and this flag is already unconditionally set. Please add a break here. > > case ONENAND_DEVICE_DENSITY_1Gb: > /* A-Die has all block unlock */