From patchwork Fri Dec 20 11:31:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182233 Delivered-To: patch@linaro.org Received: by 2002:a92:1f98:0:0:0:0:0 with SMTP id f24csp401360ilf; Fri, 20 Dec 2019 03:32:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwUygQIqfaSrvPubhi/FDvxk0g1rsiWQP0qz5zW2jD9j6tRMGLlvnFZ5qVHzDq6yybJAsqB X-Received: by 2002:a65:640e:: with SMTP id a14mr13269454pgv.402.1576841567750; Fri, 20 Dec 2019 03:32:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576841567; cv=none; d=google.com; s=arc-20160816; b=Gs5Ixy4YjlrMDTMdeANZTzUiNgKntNiCslKAWVSYeme3pSF7P3jfJJeQp0t5FUU9aa NWjaRT+IcpgZ9rclRLyMzuYtpcxZa89iUp9UOILNkNIOrscr3TU4rT109MfY4VxG2ab/ 9A+q/r41ItC7U25Jp+Jii1VypwzEsciHdiI1RI44l3swYqE9G7NJOZSQZ4SPLWmB/DEj n+AIFH1vTYP6XZIl2+CRAY+PdRvHasX4fm20mAE/8rRRX9B3/fKmJzvsqXqfWzvHDy07 MfhAOfR7ZKICwLiCUluIrU3JJLimKjuKP7n8uQVQIPgd1PULe7LCE3VFUD+JSkeehku/ 32lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:dkim-filter:dkim-signature; bh=NjqJCYHhSiFWuE3VDpaD3AaSrzULMYvDZNr68qdQ+Gk=; b=N/s7ZmOJVQr9TGQVmtbIuCtBZoRfDmrKhWCdpgGzTI3KaewuzVM7LWNATGUiD+RIX+ 6zNxDf0JXBeon2XiBINKWx9hLkl3WNOOVG/ONbSKbSyk/hHltChCvRx6YiXG8vNS2bjV AxD+WIn61scL9UMZ/B+b17vOpFEEbkUI1/6cAMas9IyUC+5A4X0hEnOmz8CQEBrAI4hd w/k7VOCJpuKthK4jNN29U3V5qDQ/2OTH6fy5glIxAQY5ZrubGfoNSbx4+kVNr/ElRJKx Zv3Rh4WnJGmgiPQYoxizsBh+8evTTv45cFJm9koqNKip4J49KWDJ0oOXTyg2WOWR81F7 Bjzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VBEo+jVy; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=pL9OgSTY; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id d4si8713227pgb.140.2019.12.20.03.32.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 03:32:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) client-ip=2607:7c80:54:e::133; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.infradead.org header.s=bombadil.20170209 header.b=VBEo+jVy; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=pL9OgSTY; spf=pass (google.com: best guess record for domain of linux-mtd-bounces+patch=linaro.org@lists.infradead.org designates 2607:7c80:54:e::133 as permitted sender) smtp.mailfrom="linux-mtd-bounces+patch=linaro.org@lists.infradead.org" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NjqJCYHhSiFWuE3VDpaD3AaSrzULMYvDZNr68qdQ+Gk=; b=VBEo+jVywdU7UHtXwev3ptuljP yuI+wqwV27nfykkbV9Trz6RWPmqSnZ4PcC4PY1Ih3KCq2Z6Jau5BCax/HoH/7BqVeIgwxUrdw+OS8 os48KXIL0FZUpZrWdLnHwscIpCJUz1HPyjc6Y+zLnOr5siPfRKa7I8rb4dg/zGpwOTnZjIKloysXo u5EZzOxuwr6Ros6BTWLuij2Nz8/aHR1eggqNupnrS+MdLebHqa/3zCqFg+fzZEOXS9iKZgKMMTZPO s7OfbURws+DnF9DUdQXT0LHYDYPiRuT04O6woW2hYJ1G0nu2FcHIYHX1cDoFSX6Cy+CIVuWy4JRJU aBVlkQVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWL-00009d-8S; Fri, 20 Dec 2019 11:32:37 +0000 Received: from conuserg-08.nifty.com ([210.131.2.75]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iiGWH-000081-C8 for linux-mtd@lists.infradead.org; Fri, 20 Dec 2019 11:32:35 +0000 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id xBKBW2Wu010984; Fri, 20 Dec 2019 20:32:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com xBKBW2Wu010984 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1576841525; bh=WGVhzVxsVRHHV9K5PX1qsTPL9sZ/TX/2a6e9iLEFkEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pL9OgSTYihHRsBMj0HJjckEVg+6jPwcYJ1MVymxrrVFMOSwkVPwH7zMi6+cqfTCpH waSMA/0JLXDGt1amff3gogIeH8tQIeV5TIkhEp2veEcozWQkOyN1cDfw4CG9S9mzme VmWg0vxUnZMBUwaYk9yc+DBk5l32sknvf8bf3mW1erkUZix5UhNzdBni865Gv6eH/c sH7HiR2XHewDHs29xNJCrqoBlyd3Nc+9MS6sLcsGT3qRvd3uMmk1ax8dGPrrOuQ3Q+ J6o0e8RgsGWUsXhszV0iZoHaqDbv4dJ/MQYhcl8JCrwjZE1oWUjazczErtLbQ09cbS E1FDCqDymC9iw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mtd@lists.infradead.org Subject: [PATCH v3 1/5] mtd: rawnand: denali_dt: error out if platform has no associated data Date: Fri, 20 Dec 2019 20:31:51 +0900 Message-Id: <20191220113155.28177-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191220113155.28177-1-yamada.masahiro@socionext.com> References: <20191220113155.28177-1-yamada.masahiro@socionext.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191220_033233_778909_74662682 X-CRM114-Status: UNSURE ( 8.79 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [210.131.2.75 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marek Vasut , Vignesh Raghavendra , Masahiro Yamada , Richard Weinberger , linux-kernel@vger.kernel.org, Ley Foon Tan , Dinh Nguyen , Miquel Raynal MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+patch=linaro.org@lists.infradead.org denali->ecc_caps is a mandatory parameter. If it were left unset, nand_ecc_choose_conf() would end up with NULL pointer access. So, every compatible must be associated with proper denali_dt_data. If of_device_get_match_data() returns NULL, let it fail immediately. Signed-off-by: Masahiro Yamada --- Changes in v3: None Changes in v2: None drivers/mtd/nand/raw/denali_dt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.17.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 8b779a899dcf..276187939689 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -118,11 +118,12 @@ static int denali_dt_probe(struct platform_device *pdev) denali = &dt->controller; data = of_device_get_match_data(dev); - if (data) { - denali->revision = data->revision; - denali->caps = data->caps; - denali->ecc_caps = data->ecc_caps; - } + if (WARN_ON(!data)) + return -EINVAL; + + denali->revision = data->revision; + denali->caps = data->caps; + denali->ecc_caps = data->ecc_caps; denali->dev = dev; denali->irq = platform_get_irq(pdev, 0);