From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B180C433E0 for ; Mon, 4 Jan 2021 13:20:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0626F2072D for ; Mon, 4 Jan 2021 13:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726670AbhADNUU convert rfc822-to-8bit (ORCPT ); Mon, 4 Jan 2021 08:20:20 -0500 Received: from relay10.mail.gandi.net ([217.70.178.230]:51687 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbhADNUT (ORCPT ); Mon, 4 Jan 2021 08:20:19 -0500 Received: from xps13 (lfbn-tou-1-1535-bdcst.w90-89.abo.wanadoo.fr [90.89.98.255]) (Authenticated sender: miquel.raynal@bootlin.com) by relay10.mail.gandi.net (Postfix) with ESMTPSA id D0640240003; Mon, 4 Jan 2021 13:19:33 +0000 (UTC) Date: Mon, 4 Jan 2021 14:19:32 +0100 From: Miquel Raynal To: Martin Blumenstingl Cc: vadivel.muruganx.ramuthevar@linux.intel.com, linux-mtd@lists.infradead.org, richard@nod.at, vigneshr@ti.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mtd: rawnand: intel: remove broken code Message-ID: <20210104141932.1037f8e3@xps13> In-Reply-To: References: <20201217221148.2877318-1-martin.blumenstingl@googlemail.com> <20210104094849.1850c993@xps13> Organization: Bootlin X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Martin, Martin Blumenstingl wrote on Mon, 4 Jan 2021 14:13:04 +0100: > Hi Miquel, > > thank you for looking into this > > On Mon, Jan 4, 2021 at 9:48 AM Miquel Raynal wrote: > [...] > > > nand_set_flash_node(&ebu_host->chip, dev->of_node); > > > - if (!mtd->name) { > > > - dev_err(ebu_host->dev, "NAND label property is mandatory\n"); > > > - return -EINVAL; > > > - } > > > > This is valid code, it's best to use a label = "my-storage"; property > > in your NAND DT node. Then mtd->name will be updated by > > nand_set_flash_node(). > so you suggest moving the check instead? > the original code flow was: > mtd = NULL; > if (!mtd->name) > return -EINVAL; > mtd = nand_to_mtd(&ebu_host->chip); > ... > > by saying that the code itself is valid you're asking me to update the > flow to the following: > mtd = nand_to_mtd(&ebu_host->chip); > if (!mtd->name) > return -EINVAL; I actually missed the fact that mtd was used initialized, but yes that is exactly what I meant! Thanks, Miquèl