Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1292854pxf; Fri, 19 Mar 2021 04:03:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+pMlRwgF7wz9TQ/Dcscb0N+fE9Z4TtL3MDXpZmGzAUbsokY+lZB2qRCaosmghU2kuk3aP X-Received: by 2002:a17:906:9152:: with SMTP id y18mr3638042ejw.19.1616151786904; Fri, 19 Mar 2021 04:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616151786; cv=none; d=google.com; s=arc-20160816; b=ji7b2Q5oFkwS/JWzfPbLmW8X2Pe4wjcc9TR+PD3tHgmsA2El9TqctLguZm1TAoSwcu bf4i0sOFESXVGuzbf18RHlY41WjNA+KBUL6QowOa8ZbTu66vZtcCP6t1ECFInya5PO00 WQZD6ZHvyBhim4QaKUVnrngnQj/hDkDjiiLbBlq9f6g8qc1xR2+lpT5EO2d1v6CiCThq Cffjt6E8mBMReV5aSc0xdRWgcHApgCwsyh2TACDOaFCiChsLRsZjFSwvIwK/g2qF1ozF 1z4K4GPhGxHk7ZaYeEQkbwb3bk8rmaZAVvn6jPF/sFSZ4bJrHaD9MI0q/tTA2Kr+qxA7 /kOA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1TpNtbXoxyIjRd7QIp1WNUGV3OlR+l0VzEx11bA72Sw=; b=SfJxXXMnqcUEY/eyuC/Ddne0o6kjdIsj8kvGWICILOhAvTsgnyW6jKb5E5RBuWjWl2 AKx/uOva4/TfR3W3EkQaUU+50+eIn1SDVZ3r6ERYgTOhqFyKlm2HSbvhGPcFSKm2gegi eG99wbo/fGm7ZutJ2LQBQligh2OSi+443FN8jHy54Bm1AxrRwX97NJF5e6hp7k2ti89W reP4JZqbJBNju9KKR7QqllgcM+mAZzSC8kdgcKC+0N8QKrUIqeTtr52MQqO1IJlyxoWR KQMwkMjV7TM6FAmuGgvOlG6KXJeB4ThklkHpzwigyBl4mP6ctRiDd+o34sZp/7I2w6xO jt5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="bGsyS/nt"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f4si3557383edm.126.2021.03.19.04.02.43; Fri, 19 Mar 2021 04:03:06 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b="bGsyS/nt"; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229933AbhCSLBw (ORCPT + 99 others); Fri, 19 Mar 2021 07:01:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbhCSLBZ (ORCPT ); Fri, 19 Mar 2021 07:01:25 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59EBCC06174A; Fri, 19 Mar 2021 04:01:24 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id y27so3425752pga.9; Fri, 19 Mar 2021 04:01:24 -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=1TpNtbXoxyIjRd7QIp1WNUGV3OlR+l0VzEx11bA72Sw=; b=bGsyS/ntHB5J/zGOzWa3dDyJ+RSrk0AxzcTTabPa/qWzSF3DAQkcBBYPCERu5rU5/L /Tpp7DtV9HaJHtMyRTwa9QF+cO1KFylnYYX0zCk3n0pCx8jDthkoiATd01qRCQl32SoJ rBFrtroMaqCCnK8fAh1FJhtZhtwxb5AdtpztX4O3YecnWYidtuMs+j3td9/dI1tAXP6l YEfWvLnIbxnmsj2t9dvTXyh//iJksnwS3T0AcYJcLvo+ZZziwXXeqaEOjXRlP28GXWMB qztwaapx0RSzcWGJBFDxMY5J3IDt3c1QgW459KejscA78lWdxtZxgJGXLYOXKCnTxLCI nYrA== 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=1TpNtbXoxyIjRd7QIp1WNUGV3OlR+l0VzEx11bA72Sw=; b=n4K/Jb249k3Wt8vRfzygKBqR1FVq+f7P9eBbytreisv7lzNflAhe2df7wpq70HUZ4B P6zUNQBynBQqafcxJyuyEQ3rGIZJrTcZY1FxAMHN04Y5Ld5momKXAWGoMCx4/gjof/zy aOGuAxHutf89AOBQnxEfeLw+sJbbb0KdrIGCR1kNzGU816+DArB62er6GZdEHybe1k1q Ns1hRsxqws3qGW/0n8xScMYGCQGNWufDHzzKSyebjfLem+C+o5GT/cOS8ixVChvl8kCl TB2XlXDITHDYJ9ad7md5fNE2Ec31NM7gcU2EsifHm28pfSTCJDRU3yTwOXbunJFj4PfR je3Q== X-Gm-Message-State: AOAM53082fndt0JTAjYMNmcWS0vM3H4/4L4+g5/4kXRgd7tf9J7dBQa7 kSRJLzuMQNdqQMt7uzaqJ0I= X-Received: by 2002:a65:520d:: with SMTP id o13mr10965823pgp.57.1616151683853; Fri, 19 Mar 2021 04:01:23 -0700 (PDT) Received: from localhost.localdomain ([156.146.35.76]) by smtp.gmail.com with ESMTPSA id i22sm4879042pjz.56.2021.03.19.04.01.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 04:01:23 -0700 (PDT) From: William Breathitt Gray To: jic23@kernel.org Cc: kernel@pengutronix.de, linux-stm32@st-md-mailman.stormreply.com, 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, William Breathitt Gray Subject: [PATCH v10 04/33] counter: 104-quad-8: Return error when invalid mode during ceiling_write Date: Fri, 19 Mar 2021 20:00:23 +0900 Message-Id: <98676f9a2e9cf991d7a002b3b264cca774e5b3c8.1616150619.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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") Cc: 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 4bb9abffae48..233a3acc1377 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -714,13 +714,14 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, switch (priv->count_mode[count->id]) { case 1: case 3: + mutex_unlock(&priv->lock); quad8_preset_register_set(priv, count->id, ceiling); - break; + return len; } mutex_unlock(&priv->lock); - return len; + return -EINVAL; } static ssize_t quad8_count_preset_enable_read(struct counter_device *counter, -- 2.30.2