Message ID | pndv8eojdey.fsf@axis.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1749178vqm; Thu, 13 Jul 2023 04:18:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlEp2rglNUf5sPCCT3/9kjweKkh7PpsY97kTH3eFN5ggLraJarWhg3+z25rF2QaD+27pW8EP X-Received: by 2002:a17:906:8b:b0:994:13c3:2f89 with SMTP id 11-20020a170906008b00b0099413c32f89mr1948340ejc.27.1689247103516; Thu, 13 Jul 2023 04:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689247103; cv=none; d=google.com; s=arc-20160816; b=N8HHaMB6QpW+SPvLjRg9RRqxnfQCusiZRVcdxB4Zb7EJE6/6Lo6KI+3UgTkfeYidH0 Xiu2sJrgSddFB7qqRiCefvUR9HqfAePKQ5UiRGAr0oTpIICJqXqHsg5PYx0d7nFieOsH tEHlibqRyjCnM97fum2X15PXcJn1M5Zu36UCtd0Hs1F6PCEK4I+j6F+EcpZVlqpn7ghq 0MvgKs/voAHiIeKRhAq1ZH/UHgcIJpi3HRkDPJYWqmOZmlTtY9x9RTN6Ut52Z2EGaGf8 4CbF1eay7J90FdkD5VJWjtwvWXKtpIspSFRV3jPowiBHSOUOIIs1MYg4zzSvXubMMTgG R/3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :user-agent:dkim-signature; bh=xM/3mEoxCUQ/wZ0ZwtpBg5cBzRBduFqs5j7ewLkHOEQ=; fh=ftIB+k+CYHfLUAU/a4e0Loa51Tj4ciVRtUnwPKg5ZEw=; b=UpFNUdqRiAvDmfVjxYlgYgBNW/1+MnTj/1mrWXn+qbjV5D88ch+Eay3vID4ibQCnU7 BOgOxgaYu9qXZpNSRD220zje60vgfcN31L7GDSuoHz1zCn7Ld5sA9/1vLJH4cZxeXIpq 2ERkB5Wb417KUw2OuJyz0tKAclQWtZqwnU/lxEt41cul8VyDK0L6ONA8KJgstGyLCrbS 8shFApmTh1r8WJD0rfJSeVOXT6Hub5NYEJtMX2rp0yeMRxUaN6cla6F1z01rQg8QqHHu isuye+CU2inRuppSeqXHLvL1fFIKjXYO5RIxt1Tw+g/0AXT1mf15qEXoerg2OkAe1FGt AaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=Cfj+QTPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qq15-20020a17090720cf00b0099316721725si6969322ejb.1044.2023.07.13.04.17.59; Thu, 13 Jul 2023 04:18:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=Cfj+QTPA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234286AbjGMKsR (ORCPT <rfc822;ybw1215001957@gmail.com> + 99 others); Thu, 13 Jul 2023 06:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234265AbjGMKr4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 13 Jul 2023 06:47:56 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F54F2683; Thu, 13 Jul 2023 03:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1689245273; x=1720781273; h=from:to:cc:subject:date:message-id:mime-version; bh=xM/3mEoxCUQ/wZ0ZwtpBg5cBzRBduFqs5j7ewLkHOEQ=; b=Cfj+QTPAjczSEviwfNA4ssljkdrCY9ySj0BN9JpLHCm5NbSC72xjKTmk 2vQwwUeJjp10+ehYzHLl89aSVjCUFKH1Bsd/9vF4rhhkb9XV828rZ2L+H RCnNB0eylM6PJMwMGn9ccmsqQSIbapAwWq1sSx6Ui9ReZGcyinRvXUenn BFQ+IQMeXaZ983gr+l8hluUWLhO9544/RzbJbV1lfISigJfMF7wM9HfVx PjUZz/NSTc4ITH5Bx7s1DX+UBUfRWTXpAqiDZaNAjv8D5f86CTkBEnpCJ mMaOY2njX6tOzAhDw+xUeDQahmKuRA7XvgG+F6UmSaQTLJEiSqb0nURs/ w==; User-agent: a.out From: Waqar Hameed <waqar.hameed@axis.com> To: Jonathan Cameron <jic23@kernel.org>, Lars-Peter Clausen <lars@metafoo.de> CC: <kernel@axis.com>, <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH] iio: Fix return value check for set_trigger_state() Date: Thu, 13 Jul 2023 12:47:31 +0200 Message-ID: <pndv8eojdey.fsf@axis.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.5.60] X-ClientProxiedBy: se-mail01w.axis.com (10.20.40.7) To se-mail01w.axis.com (10.20.40.7) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771303970900294427 X-GMAIL-MSGID: 1771303970900294427 |
Series |
iio: Fix return value check for set_trigger_state()
|
|
Commit Message
Waqar Hameed
July 13, 2023, 10:47 a.m. UTC
In `iio_trigger_detach_poll_func()` the return value from
`trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`.
However, in `iio_trigger_attach_poll_func()` it is checked with
`if (ret < 0)`. Fix this mismatch by only checking for `if (ret)` in
both places.
Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
---
drivers/iio/industrialio-trigger.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, 13 Jul 2023 12:47:31 +0200 Waqar Hameed <waqar.hameed@axis.com> wrote: > In `iio_trigger_detach_poll_func()` the return value from > `trig->ops->set_trigger_state(trig, false)` is checked with `if (ret)`. > However, in `iio_trigger_attach_poll_func()` it is checked with > `if (ret < 0)`. Fix this mismatch by only checking for `if (ret)` in > both places. I wouldn't have used fix in the title unless you have a case where this causes problems (so a driver returns > 0 for this callback). I have no problem with it as a consistency improvement but I don't really want to see it backported (which will happen with fix in the title ;) I'll tweak that and with that done, applied to the togreg branch of iio.git and pushed out initially as testing to let 0-day see if it can find anything we missed. Thanks, Jonathan > > Signed-off-by: Waqar Hameed <waqar.hameed@axis.com> > --- > drivers/iio/industrialio-trigger.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c > index f207e36b12cc..18f83158f637 100644 > --- a/drivers/iio/industrialio-trigger.c > +++ b/drivers/iio/industrialio-trigger.c > @@ -313,7 +313,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig, > /* Enable trigger in driver */ > if (trig->ops && trig->ops->set_trigger_state && notinuse) { > ret = trig->ops->set_trigger_state(trig, true); > - if (ret < 0) > + if (ret) > goto out_free_irq; > } >
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index f207e36b12cc..18f83158f637 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -313,7 +313,7 @@ int iio_trigger_attach_poll_func(struct iio_trigger *trig, /* Enable trigger in driver */ if (trig->ops && trig->ops->set_trigger_state && notinuse) { ret = trig->ops->set_trigger_state(trig, true); - if (ret < 0) + if (ret) goto out_free_irq; }