From patchwork Tue Jul 25 12:00:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Dahl X-Patchwork-Id: 9861879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4C013601A1 for ; Tue, 25 Jul 2017 12:02:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45DB025223 for ; Tue, 25 Jul 2017 12:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A60328607; Tue, 25 Jul 2017 12:02:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8A3525223 for ; Tue, 25 Jul 2017 12:02:11 +0000 (UTC) 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=UrKd2Dh8mzCdFZvLFYkdb4GtPMup9qp8xqHK8F7rETQ=; b=ha9K7jA/gxdHJpm679oLKLPa3n Yf7Kl7VzCREmg35cvuRR6elb+9y6xl0lGHkigqmnK3nzq2+GnQgB2P3RkFq5SGAbuT4Zoj+atCqOM HPNPanJ4qYlRs02Dh6igEeeP5QjctXjyNGlm3CffLvhB8lAwFBRFPUy8zpmLnY94GzqhBFwU4VuLD BApEKxu2MXbb+M/1aYgPsu81fSxIOqy2nmqNGtVzEphkEL9I2EDHp8COwO+AfC4F/KNMuT9st/R41 NNJTPEfAsfRDYwKyGXwRtkCiDXDLqfQw2tkPV9ZTZFF9slCTRKSH2iOoL0NKnJTVT+GiQJtF8FfPo 2pYyHZdA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dZyXN-0005PT-Rg; Tue, 25 Jul 2017 12:02:05 +0000 Received: from mail.thorsis.com ([213.211.200.15]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dZyWj-0004qy-2o for linux-arm-kernel@lists.infradead.org; Tue, 25 Jul 2017 12:01:28 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.thorsis.com (Postfix) with ESMTP id 1DC253A145E; Tue, 25 Jul 2017 14:02:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mail.thorsis.com Received: from mail.thorsis.com ([127.0.0.1]) by localhost (mail.thorsis.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GZTuZFgRvMkO; Tue, 25 Jul 2017 14:02:20 +0200 (CEST) Received: from seven.thorsis.com (unknown [192.168.10.7]) by mail.thorsis.com (Postfix) with ESMTP id EA52C3A141C; Tue, 25 Jul 2017 14:02:19 +0200 (CEST) Received: from ada.ifak-system.com (ada.ifak-system.com [192.168.10.62]) by seven.thorsis.com (Postfix) with ESMTPSA id 2DA53E00554; Tue, 25 Jul 2017 14:01:23 +0200 (CEST) From: Alexander Dahl To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/3] memory: atmel-ebi: Fix smc timing return value evaluation Date: Tue, 25 Jul 2017 14:00:22 +0200 Message-Id: <1500984024-26403-2-git-send-email-ada@thorsis.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1500984024-26403-1-git-send-email-ada@thorsis.com> References: <1500984024-26403-1-git-send-email-ada@thorsis.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170725_050125_407769_00CAE812 X-CRM114-Status: GOOD ( 12.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Lee Jones , Alexandre Belloni , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Setting optional EBI/SMC properties through device tree always fails due to wrong evaluation of the return value of atmel_ebi_xslate_smc_timings(). If you put some of those properties in your dts file, but not 'atmel,smc-tdf-ns' the local variable 'required' in atmel_ebi_xslate_smc_timings() stays on 'false' after the first 'if' block. This leads to setting 'ret' to -EINVAL in the first run of the following 'for' loop which is then the return value of this function. However if you set 'atmel,smc-tdf-ns' in the dts file and everything in atmel_ebi_xslate_smc_timings() works well, it returns the content of 'required' which is 'true' then. So the function atmel_ebi_xslate_smc_timings() always returns non-zero which lets its call in atmel_ebi_xslate_smc_config() always fail and thus returning -EINVAL, so the EBI configuration for this node fails. Judging from the following code evaluating the local 'required' variable in atmel_ebi_xslate_smc_config() and the call of caps->xlate_config in atmel_ebi_dev_setup() it's probably right to only let the call fail if a negative error code is returned. Signed-off-by: Alexander Dahl --- drivers/memory/atmel-ebi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/memory/atmel-ebi.c b/drivers/memory/atmel-ebi.c index 99e644c..1cf34d2 100644 --- a/drivers/memory/atmel-ebi.c +++ b/drivers/memory/atmel-ebi.c @@ -263,7 +263,7 @@ static int atmel_ebi_xslate_smc_config(struct atmel_ebi_dev *ebid, } ret = atmel_ebi_xslate_smc_timings(ebid, np, &conf->smcconf); - if (ret) + if (ret < 0) return -EINVAL; if ((ret > 0 && !required) || (!ret && required)) {