Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp648367oof; Tue, 25 Sep 2018 02:48:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV60/KD2KsDQqPnfcOIAbNf55FFqKUp8Aq5XGsQxpUkAR+HKJYxQW3QyP/YDg1WA/hNlsT5MK X-Received: by 2002:a17:902:9693:: with SMTP id n19-v6mr291701plp.282.1537868926395; Tue, 25 Sep 2018 02:48:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537868926; cv=none; d=google.com; s=arc-20160816; b=P/A6nZtIAOaOtx8cF4SYAUa9OCEyJ5Fm4Z6tLihYwqt+wyFhCQjBS7W2+KJOGnZAHN C7at83t1HV4HoYXzIkR5hD7At+v3WHVf20MeRMd2MSTZbff8D6iR1zyOuiGVx8N9jpv2 /zh8JqkXs86u3GHabb++fkaFvXEadrBZk668XrF8v9vwnGAWDIZXKtHp86madhEvV+Rz eXiyNMzAzUIF+zGoIqMrUhtsSfaZdubyxwwDJC/7phQ9CYYcP2tX7G31ZSrbenXFpcF8 1+tDzpaL7b3/a2HgwZOVcUfDBflwsqmkRTU+e9F997zmXIHKDodYMpe9IM4C8ziPsdvo wudg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=ENAjIPiTG5JI9vXAlECNHTNp+97OBAngoIMuT10QjAw=; b=AufvjrDrfl5/awGxlvcG2Iki5YvsEkBVkHP5D54yLLNHL6OI8mLmzCgCShbUpELzq0 CnmDKOKLCl2T0Gbmv0nsMJ4xIX/ZQXS3K4EOIAG6RyZV/qTBEB332ras3UGRbXZJ2VOA GB24jLIX2jdLEaj3z1QH8JGLEBnEUgvhHitFFbAYn9xIpndT3An0AOwcmWau8JmU5Rcw Cn95O7A5qev9G1Uu0Lwd2RzNfn4L2D3Oes7vZZ2g6ynnDwkRnEDpu3fH6GLg8hBHawmb OeKUiA8gQCWlbxvl0NyKG1SOP4WcPFa+cV4F3g7gv6zEGsr0Zqlr17/ZPoY2ocmMNMEg Qhug== 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 j142-v6si1982534pfd.204.2018.09.25.02.48.30; Tue, 25 Sep 2018 02:48:46 -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 S1728482AbeIYPxn (ORCPT + 99 others); Tue, 25 Sep 2018 11:53:43 -0400 Received: from laurent.telenet-ops.be ([195.130.137.89]:57084 "EHLO laurent.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726125AbeIYPxn (ORCPT ); Tue, 25 Sep 2018 11:53:43 -0400 Received: from ramsan.of.borg ([84.194.111.163]) by laurent.telenet-ops.be with bizsmtp id flmw1y00j3XaVaC01lmwdT; Tue, 25 Sep 2018 11:46:59 +0200 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1g4jvk-0001DV-Ot; Tue, 25 Sep 2018 11:46:56 +0200 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1g4jvk-0002zD-N8; Tue, 25 Sep 2018 11:46:56 +0200 From: Geert Uytterhoeven To: Mark Brown , Boris Brezillon Cc: David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] spi: spi-mem: Fix inverted logic in op sanity check Date: Tue, 25 Sep 2018 11:46:55 +0200 Message-Id: <20180925094655.11438-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On r8a7791/koelsch: m25p80 spi0.0: error -22 reading 9f m25p80: probe of spi0.0 failed with error -22 Apparently the logic in spi_mem_check_op() is wrong, rejecting the spi-mem operation if any buswidth is valid, instead of invalid. Fixes: 380583227c0c7f52 ("spi: spi-mem: Add extra sanity checks on the op param") Signed-off-by: Geert Uytterhoeven --- drivers/spi/spi-mem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index cc3d425aae56c634..62a7b80801d22098 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -169,10 +169,10 @@ static int spi_mem_check_op(const struct spi_mem_op *op) (op->data.nbytes && !op->data.buswidth)) return -EINVAL; - if (spi_mem_buswidth_is_valid(op->cmd.buswidth) || - spi_mem_buswidth_is_valid(op->addr.buswidth) || - spi_mem_buswidth_is_valid(op->dummy.buswidth) || - spi_mem_buswidth_is_valid(op->data.buswidth)) + if (!spi_mem_buswidth_is_valid(op->cmd.buswidth) || + !spi_mem_buswidth_is_valid(op->addr.buswidth) || + !spi_mem_buswidth_is_valid(op->dummy.buswidth) || + !spi_mem_buswidth_is_valid(op->data.buswidth)) return -EINVAL; return 0; -- 2.17.1