Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9101948pxu; Mon, 28 Dec 2020 06:41:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJzITPJFFrMilS0I+1tvJ1XxAYKPtEquRfFn5FHodBNL6YmasUfMzDK5sthcQ9UqvwKBzYpJ X-Received: by 2002:a17:906:30c4:: with SMTP id b4mr41299798ejb.456.1609166473480; Mon, 28 Dec 2020 06:41:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166473; cv=none; d=google.com; s=arc-20160816; b=E4FAQ9A8rQa6VK7JTljq9yQQvR+oB6jScndN24vI4vtDiOzeg99FcA04S6lT2ep1A9 mK8scS0jb0IQpm3VnpVGzXqH78xbOvpFtFuyd7JIR2Of+lRjXd0xYRZb9NJKLZoPvDKw DKSh+dOuG7G6yvyxE5NTpOr3ImS0orN09Hp+RL34cdvYNcl0mh8iPIc1WAAcm2Li9pzp qHKNgo4mhYLcq9tq7QCDdfJaW8MWGcLJgKynVeWeFUKE44jrVQDCWlnThFUJnF7ulNXi WEGVvMd55A6M+VuHbUDYbNMzgq4IbYazpSjCcN6+wYO/4Rei8/mhYRygT4mZ9UxWSYS0 0eHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=e6ZAgQOtddGNLEM+hTQeuqX6lSzgZzSdX87jLu69CYM=; b=gH+MluDeZG6d5Ay2WEnAJDRyjLUpYMhx/P9QvRdTaOTzXYFazenCAWr6FJ6WyJYVsl PUNZ7G2GdwQC/4YqhXxyK0jEs3uMTW5qEBWx7ZDEZxQm1soTlXBZFp1E/hvr55TmKFKE l3tOlzQrosjP8jhZACWi4uypJeNFPu37LsdkKsrswU/067UetM2jLsqm6tSRzfpkIMIJ NIJe0leCgWk9Kt5KJ2YrtdBeSe3goehbVvtaG8TWUOL3Jnxr0MgffDM6fQ35+ZEGjumM zUDySPrBaoz3wvXRcUgj1oAqFl2Lx88iYYkLn+giHUBUP0xBN0hdWGq+INNdl9aPnBFV 129g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tHR+4R4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cb26si18266399ejb.487.2020.12.28.06.40.51; Mon, 28 Dec 2020 06:41:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tHR+4R4A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2505680AbgL1Ois (ORCPT + 99 others); Mon, 28 Dec 2020 09:38:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:39652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390383AbgL1Obn (ORCPT ); Mon, 28 Dec 2020 09:31:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B02702063A; Mon, 28 Dec 2020 14:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165888; bh=mHnbGPAl7oQQAM2WMBXqXFUVy/YH317CVojGgq9XwiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHR+4R4A6h8btQcrogw2eg2EIy/GJfymPidMIlQWtrMbtXIean8Nkr9+KXvkxy3y7 p/olKh1wYbeqVcP5OspQrwkEQfKeW3LywxNbUVn2DIB+8AYbYYvgAhVPmZTusOcaWl qe1jmSKrtfuTFroEYFoxp3CMxjFMR+36hkKhbaUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Breathitt Gray , Alexandre Belloni , Kamel Bouhara , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.10 691/717] counter: microchip-tcb-capture: Fix CMR value check Date: Mon, 28 Dec 2020 13:51:29 +0100 Message-Id: <20201228125054.081521313@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: William Breathitt Gray commit 3418bd7cfce0bd8ef1ccedc4655f9f86f6c3b0ca upstream. The ATMEL_TC_ETRGEDG_* defines are not masks but rather possible values for CMR. This patch fixes the action_get() callback to properly check for these values rather than mask them. Fixes: 106b104137fd ("counter: Add microchip TCB capture counter") Signed-off-by: William Breathitt Gray Acked-by: Alexandre Belloni Acked-by: Kamel Bouhara Cc: Link: https://lore.kernel.org/r/20201114232805.253108-1-vilhelm.gray@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/counter/microchip-tcb-capture.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) --- a/drivers/counter/microchip-tcb-capture.c +++ b/drivers/counter/microchip-tcb-capture.c @@ -183,16 +183,20 @@ static int mchp_tc_count_action_get(stru regmap_read(priv->regmap, ATMEL_TC_REG(priv->channel[0], CMR), &cmr); - *action = MCHP_TC_SYNAPSE_ACTION_NONE; - - if (cmr & ATMEL_TC_ETRGEDG_NONE) + switch (cmr & ATMEL_TC_ETRGEDG) { + default: *action = MCHP_TC_SYNAPSE_ACTION_NONE; - else if (cmr & ATMEL_TC_ETRGEDG_RISING) + break; + case ATMEL_TC_ETRGEDG_RISING: *action = MCHP_TC_SYNAPSE_ACTION_RISING_EDGE; - else if (cmr & ATMEL_TC_ETRGEDG_FALLING) + break; + case ATMEL_TC_ETRGEDG_FALLING: *action = MCHP_TC_SYNAPSE_ACTION_FALLING_EDGE; - else if (cmr & ATMEL_TC_ETRGEDG_BOTH) + break; + case ATMEL_TC_ETRGEDG_BOTH: *action = MCHP_TC_SYNAPSE_ACTION_BOTH_EDGE; + break; + } return 0; }