lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1419687233-10498-1-git-send-email-der.herr@hofr.at>
Date:	Sat, 27 Dec 2014 08:33:53 -0500
From:	Nicholas Mc Guire <der.herr@...r.at>
To:	Wolfram Sang <wsa@...-dreams.de>
Cc:	Grant Likely <grant.likely@...aro.org>,
	Rob Herring <robh+dt@...nel.org>,
	Yao Yuan <yao.yuan@...escale.com>,
	Fugang Duan <B38611@...escale.com>,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Jingoo Han <jg1.han@...sung.com>,
	Kaushal Butala <kaushalkernelmailinglist@...il.com>,
	Sedat Dilek <sedat.dilek@...il.com>, linux-i2c@...r.kernel.org,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	Nicholas Mc Guire <der.herr@...r.at>
Subject: [PATCH v2 -next] i2c: imx: fix handling of wait_for_completion_timeout result

wait_for_completion_timeout does not return negative values so 
"result" handling here should be simplified to cover the actually
possible cases only.

patch was only compile tested for imx_v6_v7_defconfig 

V2 spellchecked this time and proper labeling as 
   suggested by Sedat Dilek <sedat.dilek@...il.com>

patch is against linux-next 3.19.0-rc1 -next-20141226 

Signed-off-by: Nicholas Mc Guire <der.herr@...r.at>
---
 drivers/i2c/busses/i2c-imx.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 7f3a9fe..2be7d9d 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -628,9 +628,9 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
 	result = wait_for_completion_timeout(
 				&i2c_imx->dma->cmd_complete,
 				msecs_to_jiffies(DMA_TIMEOUT));
-	if (result <= 0) {
+	if (result == 0) {
 		dmaengine_terminate_all(dma->chan_using);
-		return result ?: -ETIMEDOUT;
+		return -ETIMEDOUT;
 	}
 
 	/* Waiting for transfer complete. */
@@ -686,9 +686,9 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
 	result = wait_for_completion_timeout(
 				&i2c_imx->dma->cmd_complete,
 				msecs_to_jiffies(DMA_TIMEOUT));
-	if (result <= 0) {
+	if (result == 0) {
 		dmaengine_terminate_all(dma->chan_using);
-		return result ?: -ETIMEDOUT;
+		return -ETIMEDOUT;
 	}
 
 	/* waiting for transfer complete. */
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ