From patchwork Sat Feb 9 09:03:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10804415 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CEB013B4 for ; Sat, 9 Feb 2019 09:04:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 085542D1C3 for ; Sat, 9 Feb 2019 09:04:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EE1CD2D1E0; Sat, 9 Feb 2019 09:04:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A60032D1C3 for ; Sat, 9 Feb 2019 09:04:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726831AbfBIJEa (ORCPT ); Sat, 9 Feb 2019 04:04:30 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:41074 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726047AbfBIJE3 (ORCPT ); Sat, 9 Feb 2019 04:04:29 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x198wiZL141927; Sat, 9 Feb 2019 09:04:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=+uARhowKqnNoU+kHBw7ON2mrOb3+CtHRtiY55ghYQqw=; b=iRMU1a0stwwZpsg3Upu99bPQBLGMmL6wwQxHeYqfKv6TVB/kz7OmmvnunZhuHNYx8mxQ g9OJ1kFrlxupyj2TuI9Z06DgpsUpevELUxxqKiOy1PZ48GMUffE9A7fXAf7ceAl9ExtL DaYk7jiVOSPmwQkWPwxe54hIROIeo40tzzHEzuCMIsaqf6qKKgKrLclfQaCy0msjrwb6 IZ+5y3Ete9YzNy6rSC2V9cofQxjlM/2UUDTQ9AtTx7Pgtg31QamcUulVgtpm8c467gTR ZEL1TUOfh5tYl+SlTo8vcDkFjK9HitBkLwzKjAat75W7T4TmCZ6k2snsVBystITCos/X Wg== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by aserp2130.oracle.com with ESMTP id 2qhre50808-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 09 Feb 2019 09:04:02 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id x199415E005349 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 9 Feb 2019 09:04:02 GMT Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x19941p1021672; Sat, 9 Feb 2019 09:04:01 GMT Received: from kadam (/197.157.0.32) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 09 Feb 2019 01:04:00 -0800 Date: Sat, 9 Feb 2019 12:03:52 +0300 From: Dan Carpenter To: Jonathan Cameron , Tomasz Duszynski Cc: Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] iio: chemical: sps30: fix a loop timeout test Message-ID: <20190209090350.GD4865@kadam> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9161 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902090067 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The "while (tries--) {" loop is a postop so it exits with "tries" set to -1. Fixes: 232e0f6ddeae ("iio: chemical: add support for Sensirion SPS30 sensor") Signed-off-by: Dan Carpenter --- drivers/iio/chemical/sps30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c index e03a28a67146..375df5060ed5 100644 --- a/drivers/iio/chemical/sps30.c +++ b/drivers/iio/chemical/sps30.c @@ -210,7 +210,7 @@ static int sps30_do_meas(struct sps30_state *state, s32 *data, int size) msleep_interruptible(300); } - if (!tries) + if (tries == -1) return -ETIMEDOUT; ret = sps30_do_cmd(state, SPS30_READ_DATA, tmp, sizeof(int) * size);