From patchwork Tue Jul 13 09:53:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 12373321 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7FA9C11F66 for ; Tue, 13 Jul 2021 09:56:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A3BB61158 for ; Tue, 13 Jul 2021 09:56:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A3BB61158 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FcM1Q/RsHN8NeKWt7GO3USaMn1EnjpxrjgLyBCtvUmk=; b=UoC0AVpJUokUGD SlANWh9OCMSMdniyLRhUxTEwBvZCI1nHr9NS3TCzK/dLYIeoQl9w4fDixJhhvCQi2/FzKKJ8+K86S OCwoNJ27ouHDCBjSD1LAxIub8/Pc5yol65Zyi/gLWe7WiA0fAMzZOA2ucNFHd36H8OHQmJmudkIM1 hb0FccehSMUUPLBUJSO6tBr8N3yEYCqMw2roAJqqFVz7ZFExw/nmvpnpNl6PZmJOpPsnTDwO+MPJb Hyj/aJwmlpNp99SiLeTX+n7d0gTCq7H9E59MQtJ7b/yuFfAwugYJM7zvZZbVW1MB9FPXM7HOcWZ5w wwCvA62/R3IiIAe6sFjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3F6t-009jc7-MZ; Tue, 13 Jul 2021 09:53:52 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3F6o-009jaJ-2N for linux-arm-kernel@lists.infradead.org; Tue, 13 Jul 2021 09:53:47 +0000 Received: by mail-pl1-x631.google.com with SMTP id v14so3885403plg.9 for ; Tue, 13 Jul 2021 02:53:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lwJZ+FRHmPdVwm0/Cne9BWGWHB7Nx2ph+8GMBriVPGo=; b=FgqZxAVKxvO+GCExH/zFMu9YuTw8GDamGJ/5dup4vhtKhwmmzjeYgMHLJsacEIqAC7 yHJ7wXfseuCn0kxxJZRhz0kcpxVXpX21zWkUCKCKoIJCYxiW8d3P1aYJ2ULsd6HwOTGy /y+l0oce8pwfMDr8QT46b8Fb6E28WbNOauPQAeB0dkLqXpCrpcFqxQnHqiqUFYKh+f/G gVMwkS27jhQBD8ROukvn8RUEYmlh1TEJWgelVGy3ELBgQN883/H72pMhAyrs968bKNMj K/EOKAoBaagMqRMMOSVFkEfG2XbEXdfi3RXVLqv781vdlN8p3rLvdKHsAHU24IkplFCn HFSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lwJZ+FRHmPdVwm0/Cne9BWGWHB7Nx2ph+8GMBriVPGo=; b=nd73dc5pkl0nIlXI4w7LyZ4lvSzQuiIYiHV/V53jp43pX5BJVJdiHBg1Rx6YjbK5hS Xepqx9oWpe+xl40gL/0EiiCNAJh+Dbv6keyC2rP+skhTNccfyXhUnxaM9229bCmXNeIV 0x+eIdlcZX3qaHHm3lyp1q/CaGR0QHeb02OVhTyZArStZ6hmNUIlcfox6hFSuzblQcdV +Ujo+TyV/GB5uw6DOmjMlE8GR81ukX2mu1DKIhEzCdqxfz2uNAqkEXUL7BR3+J4ElHOa AgW6XdMvoA3QKC/Qf2f4G9Ch4SLbN732Mpl0a/JttcVvX9sWuqJuxe39mWIxWogArlGq TYLg== X-Gm-Message-State: AOAM5314EMeyGKmQ55aHYyjSCJspoyKdxXpcnb0rYPOEbFEUF0wk6W2e 4hDj+5lOjwLDggzLcionj0Y= X-Google-Smtp-Source: ABdhPJyZJg0h7/PGYh3gQwJmWPbdH2EnidAws8IJ5RP3cPzf0/4r23v8F6aWYAnS6YeHPh6wmMpmFA== X-Received: by 2002:a17:902:b193:b029:11a:a179:453a with SMTP id s19-20020a170902b193b029011aa179453amr2841400plr.69.1626170025528; Tue, 13 Jul 2021 02:53:45 -0700 (PDT) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id f6sm18153854pfj.28.2021.07.13.02.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jul 2021 02:53:45 -0700 (PDT) From: William Breathitt Gray To: jic23@kernel.org Cc: linux-stm32@st-md-mailman.stormreply.com, kernel@pengutronix.de, a.fatoum@pengutronix.de, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, o.rempel@pengutronix.de, jarkko.nikula@linux.intel.com, William Breathitt Gray Subject: [PATCH v13 01/17] counter: 104-quad-8: Return error when invalid mode during ceiling_write Date: Tue, 13 Jul 2021 18:53:05 +0900 Message-Id: <5a9678944e953d23e0ee2a53d3c61e700cb1cd89.1626165765.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210713_025346_198938_7F48128A X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The 104-QUAD-8 only has two count modes where a ceiling value makes sense: Range Limit and Modulo-N. Outside of these two modes, setting a ceiling value is an invalid operation -- so let's report it as such by returning -EINVAL. Fixes: fc069262261c ("counter: 104-quad-8: Add lock guards - generic interface") Acked-by: Syed Nayyar Waris Signed-off-by: William Breathitt Gray --- drivers/counter/104-quad-8.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c index 09a9a77cce06..81f9642777fb 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -715,12 +715,13 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, case 1: case 3: quad8_preset_register_set(priv, count->id, ceiling); - break; + mutex_unlock(&priv->lock); + return len; } mutex_unlock(&priv->lock); - return len; + return -EINVAL; } static ssize_t quad8_count_preset_enable_read(struct counter_device *counter,