Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4568840imm; Wed, 30 May 2018 08:00:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJBhYIEm+JoyoTBzS0HeOScKPSIhGwxYR+jJfjvspzYemW2rzBAe67w6j8py0D7DZ0m1ZaB X-Received: by 2002:a65:4a87:: with SMTP id b7-v6mr2506322pgu.271.1527692438375; Wed, 30 May 2018 08:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527692438; cv=none; d=google.com; s=arc-20160816; b=xkdwzekG9vdVQoMOmTp3t3QOe4MhmYMZmPEZ2NwSskL3DTwogjslxLkQHozT/UEY4/ bfen8NTUxWPvUh4yY/IuJYznzAIaouBrcMKckz8NZC9BeALdsF2ktxY+sSVpRVe2NPIO EL//LaCHQAXtUX/njk+MJDIFkqegXIc88MVuRqL5ctF4RPwKbLgNTpb11BoidtcD+IgV ErkUHuai8cHiChrc4hAFVKH+L4/+fz3UDFpGfoDX06rhizz3dsm7GG3Hkum9E0R5BmAB DUQcAlqUICOO3bpph0mOPw6INJF3uQTvlnAe7KrVUOzys2CV0GYqzNMiVKbEtOCAxFZN u7pw== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=JnE5qWBSZgWrBrMh+fGArh8v4L9+oWq265qkLw0MuTs=; b=LQ64hWbELtVvuV25rnNIejajBbB461XiyFFBF86cIn6mOCHJ69yYzcsKlB3iOdbV1O PuTeeZwd9tZHobpJxicm6mir1GY5s5qqKqAuJYKAGR68bq2x7P44bT5CUNz846Ag13Hb KHQtERbitexfJQhy73tlWW6eNLTS9z60kcyzu5W25tH9UzZPK8p6zKYD4xAbvdIJOXO5 683z7TvpgWVHSlXtpz6obR0IYbhy4dXgj2UhuaxaFReXFL/VAe7NJER2MM9RNwIYIoOD 7Pp+wNIsaIQp9QqHGYpeRqkafFDVWKeXoybpkakjKJVh/5VyXkT9zNXpHzJOAcUIZ2ic mPrw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7-v6si27417557pgv.658.2018.05.30.08.00.20; Wed, 30 May 2018 08:00:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753613AbeE3O6V (ORCPT + 99 others); Wed, 30 May 2018 10:58:21 -0400 Received: from mail.bootlin.com ([62.4.15.54]:45828 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753113AbeE3O6S (ORCPT ); Wed, 30 May 2018 10:58:18 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 11D7D20828; Wed, 30 May 2018 16:58:17 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (AAubervilliers-681-1-125-111.w90-88.abo.wanadoo.fr [90.88.63.111]) by mail.bootlin.com (Postfix) with ESMTPSA id AAAF720713; Wed, 30 May 2018 16:58:16 +0200 (CEST) Date: Wed, 30 May 2018 16:58:16 +0200 From: Boris Brezillon To: Frieder Schrempf Cc: linux-mtd@lists.infradead.org, linux-spi@vger.kernel.org, dwmw2@infradead.org, computersforpeace@gmail.com, marek.vasut@gmail.com, richard@nod.at, miquel.raynal@bootlin.com, broonie@kernel.org, david.wolfe@nxp.com, fabio.estevam@nxp.com, prabhakar.kushwaha@nxp.com, yogeshnarayan.gaur@nxp.com, han.xu@nxp.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/11] spi: Add a driver for the Freescale/NXP QuadSPI controller Message-ID: <20180530165816.371dc39c@bbrezillon> In-Reply-To: <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> References: <1527686082-15142-1-git-send-email-frieder.schrempf@exceet.de> <1527686082-15142-4-git-send-email-frieder.schrempf@exceet.de> X-Mailer: Claws Mail 3.15.0-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Frieder, On Wed, 30 May 2018 15:14:32 +0200 Frieder Schrempf wrote: > + > +static const char *fsl_qspi_get_name(struct spi_mem *mem) > +{ > + struct fsl_qspi *q = spi_controller_get_devdata(mem->spi->master); > + struct device *dev = &mem->spi->dev; > + const char *name; > + > + /* > + * In order to keep mtdparts compatible with the old MTD driver at > + * mtd/spi-nor/fsl-quadspi.c, we set a custom name derived from the > + * platform_device of the controller. > + */ > + if (of_get_available_child_count(q->dev->of_node) == 1) > + name = dev_name(q->dev); > + else > + name = devm_kasprintf(dev, GFP_KERNEL, > + "%s-%d", dev_name(q->dev), > + mem->spi->chip_select); > + > + if (!name) { > + dev_err(dev, "failed to get memory for custom flash name\n"); > + return dev_name(q->dev); Hm, not sure that's what we want. We should probably fail when the allocation fails. How about letting ->get_name() return an error pointer or NULL in case of error. With the other I made suggestion in my review of patch 1 (calling ->get_name() at probe time) you could refuse to probe the device when ->get_name() fails. > + } > + > + return name; > +} > + Regards, Boris