From patchwork Tue Aug 3 12:06:11 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: 12416125 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 B567DC4338F for ; Tue, 3 Aug 2021 12:13:57 +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 6281060E97 for ; Tue, 3 Aug 2021 12:13:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6281060E97 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=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=MP+NAE6jlOYIhp h34CMtiKTJZ0DNibwBYQ+9jhxaYNtjK/CbIPruSabZ4OgUxqE6BL2XKcQlCwxl1VR5J7oIEEwmM9A doeo218dJKzSWV6BemdABpOgcVSEPDHTnVYl7xU8HjbIwbpECDOwBMUCCoCiVPcESALXrRW4GdZjs QiURcr85S2Lsf+GcjYPf0SZ+erfKDJpUxu6s3S36BpizH0DDPLhzbPOyJhL144mqQjpiPHtRy62Bv hWuUlN/PDJmu7UpWzrkN7hvcCBEHHSF2YPv5HqsYpve1SR2R97m0XmFtT/lkE/Y9ZNGG6GanB/AG7 2wqHIKRuJlQgBJHMpO7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAtGQ-002Xiv-Pa; Tue, 03 Aug 2021 12:11:20 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mAtC2-002Vvf-F9 for linux-arm-kernel@lists.infradead.org; Tue, 03 Aug 2021 12:06:47 +0000 Received: by mail-pj1-x1034.google.com with SMTP id b1-20020a17090a8001b029017700de3903so2679391pjn.1 for ; Tue, 03 Aug 2021 05:06: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=NTem+pkvyz3M/u5VjRQwsmmDGNloiGzV+oR7glIH/HFdYnQ98DNxbSymxCdY3BgM2s QlRWpKLt6GwQS5p2H0N3+EC2EmgbDJlRmSFh88V1cwtyTO9GwsjM1vOXa/EzambMhA5A 3A185UhljFQ5NZqBtccFkRd7hFEbz4aUqYX11e3AWjVdJcE7wQdfkx9te9CfVddqUYHk A3UDKpIoTCv10Vor/i8a3hjcHvSIaoRZxchRh090Ky/qt1gg86EjQl8uAr5ILYb/5ioR sNLP9OQIiFI0WVyVUk3FucUJdke5raumtLdEuvJC4vgg/Voq15hk6lYLOInoemwzAGqa df5w== 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=YxcNOnp7RM0r162d64RDImVoULpFvSPb19chNScLjIYIXYLHSS0fDxVMTk2Ll05r8u VddACPPVeZzHlhEnX244DBItZN+0sm64GCLIBc7Mye30D9bdR7iN6pdEAN7G1S94nDb6 2sGZvPLLyfsB+yp9CMeXzrXFICVvz23vlRIIaO2iWWxQYEclc0ULz2VFijrf/C/iBpF9 i785aXtMHBOmd5JuLH4hodM7xc5WGRlc1xBkRU9vAmiFByZhrTL9kyZhhAK5c80AKIIu bSY1z2Cj1XVweduFU96D7jPTaJ4JareH7lXs5g5YAGzCW4gLgTihfkZ+YEN9fGNLq+pI jHVQ== X-Gm-Message-State: AOAM532A5PdSxF+hEcHXpyQQJzXE1xJBo1GxaEOYfjt8e2XUVk4mN+X9 0fKhc4QZ3OZlWJwoKjoMOFM= X-Google-Smtp-Source: ABdhPJx7iYzeWpTrP94hIsTJ4WXIr0TQZsRbh0RmiS5LYEvELWQrYXJERtSsV13WL96l31egt9ZJ1g== X-Received: by 2002:aa7:8d56:0:b029:327:6dc:d254 with SMTP id s22-20020aa78d560000b029032706dcd254mr22101625pfe.69.1627992405250; Tue, 03 Aug 2021 05:06:45 -0700 (PDT) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id n35sm7197502pfv.152.2021.08.03.05.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Aug 2021 05:06:43 -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 v14 01/17] counter: 104-quad-8: Return error when invalid mode during ceiling_write Date: Tue, 3 Aug 2021 21:06:11 +0900 Message-Id: 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-20210803_050646_587871_0BD5AC64 X-CRM114-Status: GOOD ( 11.94 ) 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,