Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4829253ybl; Wed, 22 Jan 2020 05:31:02 -0800 (PST) X-Google-Smtp-Source: APXvYqyZ7JYIrGo23HZ/Vqh69Lj0ROgLMJXnk9X8bAQEWO9HXiFbATkyvHblje4X2CZUWuz+UXwO X-Received: by 2002:a05:6808:197:: with SMTP id w23mr7002689oic.46.1579699861750; Wed, 22 Jan 2020 05:31:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699861; cv=none; d=google.com; s=arc-20160816; b=Ci8HRxl4bmTZh6rweF+sXtBrL552GUfcJiu9FJsOH5HR49QTTwAKH20tjT09HIHs8e jUWRabq5bCcboj5u/mCtxfIMUS3LVL55SaDmVHdZgknvC13APLPChbGFtuAwfI8vDo9O C2xDcApEk0NxlpadxFvVW7CSBaSoj0XQIKW1lm15A2LEr0QJRthkeDEP/q9FtKJu7efM qlNghoaYh9uqZ6KdiOj46fwIEjOJT7OJeU8SWX6cyJbRHYuvgynfc92SjlLtorVMJj2v 6vWdCzSxBv3FEPIzK+M8AZqY6fEtff3mvqjvC4h5niCaGpQ+HwRSb8hLN5fh6Qa/44sJ LzVg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bQv5YXEk/ZPDDqUOoT7y86nN/a9VqPchkwePYmH1O38=; b=Nby3TW8d7TkKgzih10+SxTPGcIqNfxZclAvG/+kLTfB7f5MQDJrH5QLVFYI9dLUM5w oMO22HQO90Kkpy1rWvXpyapxjxJkQ0SBL8UhpGMphJ7gny7g4so3cO7kR1Ah3IuUhZov Qw1pmRNglprl8c0ocv7EX9KFzPhWh7tPizHqiPvJLMGsRgEN1mKHnETZch/8Bt9/D0Od d7BOUJri7Ob3zntQN3HTnkFWJTFdPnugMKSB4mdnCka59/w77zo2H0Ux64Ghpjny86ZP jLEqC+qDQHbFlmhut1KYL/5GMC21n3E9DXdf1nBu/x1p/4mWc2ojPZU2/K+bvldDriIt IPLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=RadIwp17; 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 w23si22870482oti.39.2020.01.22.05.30.49; Wed, 22 Jan 2020 05:31:01 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=RadIwp17; 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 S1731249AbgAVN2m (ORCPT + 99 others); Wed, 22 Jan 2020 08:28:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:50906 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729106AbgAVN2d (ORCPT ); Wed, 22 Jan 2020 08:28:33 -0500 Received: from localhost (unknown [84.241.205.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C5D2F2467A; Wed, 22 Jan 2020 13:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699713; bh=Ts68ShsdzOG9Fa9chgZq5ppLdpZ2ie9mY1mXFf7rshs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RadIwp17JNhM8cx9IS+tEeP/q1+JVFSO7KqELEuUxpDhKfrgUYLUFcsyYVQm3mGOJ 9TIdgysz97l/jjiByDoU8wW4J8sKTZAJxfkUqBzW2c8qmBI0CdeArjMrXMHcjekmXa NOSBJIqktrrY6zd3MUxHwu4Adjd1rHfSv5qxpAbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Shtylyov , Vignesh Raghavendra Subject: [PATCH 5.4 194/222] mtd: cfi_cmdset_0002: only check errors when ready in cfi_check_err_status() Date: Wed, 22 Jan 2020 10:29:40 +0100 Message-Id: <20200122092847.592021002@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sergei Shtylyov commit 72914a8cff7e1d910c58e125e15a0da409e3135f upstream. Cypress S26K{L|S}P{128|256|512}S datasheet says that the error bits in the status register are only valid when the "device ready" bit 7 is set. Add the check for the device ready bit in cfi_check_err_status() as that function isn't always called with this bit set. Fixes: 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling status register") Signed-off-by: Sergei Shtylyov Signed-off-by: Vignesh Raghavendra Signed-off-by: Greg Kroah-Hartman --- drivers/mtd/chips/cfi_cmdset_0002.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/mtd/chips/cfi_cmdset_0002.c +++ b/drivers/mtd/chips/cfi_cmdset_0002.c @@ -136,6 +136,10 @@ static void cfi_check_err_status(struct cfi->device_type, NULL); status = map_read(map, adr); + /* The error bits are invalid while the chip's busy */ + if (!map_word_bitsset(map, status, CMD(CFI_SR_DRB))) + return; + if (map_word_bitsset(map, status, CMD(0x3a))) { unsigned long chipstatus = MERGESTATUS(status);