From patchwork Fri Feb 12 12:13:34 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: 12085177 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.7 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,URIBL_BLOCKED, 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 956F0C433E0 for ; Fri, 12 Feb 2021 12:17:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3893464E2A for ; Fri, 12 Feb 2021 12:17:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3893464E2A 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=H8UKArEr6ISrBNkcaYdfs8XGdRaO04NKtqpFy1mw1hM=; b=Y6k+f1vWCzBzZRezgKv3czOr2 hcopqGZIOALI0DSyMgXlkZDPHrNHcGYPzJtZfPYEcBZtaX4dr6c4qTiV+KlDPiNxse3QslO+V/Px0 E7XIlQDE7+lfSDpT9SGxa7ANl9Ctx3y4NPdgKaTNstK6NYErdUy6ymdNT3zQuMmkZPSwzjsg6W0ch TL+q5VIn8LGwO2GEjnXNFoUexkyLNiYyDvM+xZbetJeKTgcQgfYOREAd7Vks4b7rsTDX6xzNmK+zZ 5dpy5n4oovJXIxTxcIhxvFUOCftQ3KsWSTAugWq2m/HPu6iMTXnl3sRwbXwjSihvm+3PQjETgvqRS 7roNygefg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAXMa-0006tw-Rc; Fri, 12 Feb 2021 12:15:56 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lAXLg-0006UR-EH for linux-arm-kernel@lists.infradead.org; Fri, 12 Feb 2021 12:15:06 +0000 Received: by mail-qv1-xf36.google.com with SMTP id e9so3490441qvy.3 for ; Fri, 12 Feb 2021 04:14:59 -0800 (PST) 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=GMBo1ioqzSWP/+ctxewh1wOwLDNrQeon20dNDOAUAHw=; b=hQ0Mp5RpZlnJ4z7vBeY7wfDFk7YmZgacLz9RZUwVCSvVP3N1CQLZvJ2TvXO7rCvuvV z37Fi3XcatNtV1SOTkawn4TtfwGaU0t66rIF5Q88q+Z4YdrjF6leoL7K3RLGZs5ZTEua LKq7PBLsjiZJUH8F5/BV8At8laep9rTiJD32bLubMRVrySWSYtbN+8uIuS15dy52UAsx w6xlOJC0BJN/Y2gKGEnU3NSSFzAyCS9paLiv97kmnL6iLz/CMM8zB+BKbeQB6YkLsSAz rqvNntr3HKHG1VNCd7aNL3Rr0iqsf24x/qITyyj75jWXaplyVeD1Dzyhc/m4Q6K80u5o OWmA== 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=GMBo1ioqzSWP/+ctxewh1wOwLDNrQeon20dNDOAUAHw=; b=haQy9tJ+OznLQmszC94lFF8w6apNas91aiuA0d0kLRUkfNhcmg5NgTVh6llHnMl/gH eh8jRJ1mKkRT06KmqeUB522J0ZBG0CM/riS+s/EzXNp0Dozgu/3W1DOFK8Hy3iSehCLc CN/k/JOd4XMAK3rO3JrxBX0Pl6SsUBDxaQEZpfT5UTDeLWEXjFCHCnTGmHN5s/e1YZhz jxRrTeW2Doq6wO4y8SXLT84ahtT4aEnDMtHnWkJNv/XXE2KRMSlR0XS/RvBReNg6H5Cw wkmrlee7XacLQm5dOrJ9N5LpG/DYBooC9FkWKHn/ojXajt9AT8ZHWtRM1J5ujvRK2p1g zhlw== X-Gm-Message-State: AOAM532DMjgXL5DoS5H3LC4Ybje44ah8BannJHrYHN6sIBJ2MhSQrHde 4qpHo9YDRG8tz+ua9DhJBZE= X-Google-Smtp-Source: ABdhPJyz0q+/nPHNN5O8M7RjDuPNfxOYsgS2grh/B4LOITzmnACa6UfxzpaYY/SEWbBLqAPpQ27sYA== X-Received: by 2002:ad4:4693:: with SMTP id bq19mr2242483qvb.43.1613132098140; Fri, 12 Feb 2021 04:14:58 -0800 (PST) Received: from localhost.localdomain ([193.27.12.132]) by smtp.gmail.com with ESMTPSA id y135sm6278534qkb.14.2021.02.12.04.14.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Feb 2021 04:14:57 -0800 (PST) From: William Breathitt Gray To: jic23@kernel.org Subject: [PATCH v8 10/22] counter: Standardize to ERANGE for limit exceeded errors Date: Fri, 12 Feb 2021 21:13:34 +0900 Message-Id: <7fa80c10fcd10d1d47d1bddced2b2cca3ff59ba9.1613131238.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.30.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-20210212_071500_549182_1030EAE0 X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org, a.fatoum@pengutronix.de, david@lechnology.com, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, alexandre.belloni@bootlin.com, mcoquelin.stm32@gmail.com, linux-kernel@vger.kernel.org, o.rempel@pengutronix.de, kernel@pengutronix.de, William Breathitt Gray , fabrice.gasnier@st.com, syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, alexandre.torgue@st.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org ERANGE is a semantically better error code to return when an argument value falls outside the supported limit range of a device. Cc: Syed Nayyar Waris Cc: Fabrice Gasnier Cc: Maxime Coquelin Cc: Alexandre Torgue Signed-off-by: William Breathitt Gray Reviewed-by: David Lechner --- drivers/counter/104-quad-8.c | 6 +++--- drivers/counter/stm32-lptimer-cnt.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/counter/104-quad-8.c b/drivers/counter/104-quad-8.c index 674263b4d2c4..a2cabb028db0 100644 --- a/drivers/counter/104-quad-8.c +++ b/drivers/counter/104-quad-8.c @@ -154,7 +154,7 @@ static int quad8_count_write(struct counter_device *counter, /* Only 24-bit values are supported */ if (val > 0xFFFFFF) - return -EINVAL; + return -ERANGE; mutex_lock(&priv->lock); @@ -671,7 +671,7 @@ static ssize_t quad8_count_preset_write(struct counter_device *counter, /* Only 24-bit values are supported */ if (preset > 0xFFFFFF) - return -EINVAL; + return -ERANGE; mutex_lock(&priv->lock); @@ -716,7 +716,7 @@ static ssize_t quad8_count_ceiling_write(struct counter_device *counter, /* Only 24-bit values are supported */ if (ceiling > 0xFFFFFF) - return -EINVAL; + return -ERANGE; mutex_lock(&priv->lock); diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c index daf988e7b208..d5f9d580d06d 100644 --- a/drivers/counter/stm32-lptimer-cnt.c +++ b/drivers/counter/stm32-lptimer-cnt.c @@ -283,7 +283,7 @@ static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter, return ret; if (ceiling > STM32_LPTIM_MAX_ARR) - return -EINVAL; + return -ERANGE; priv->ceiling = ceiling;