Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933503AbbFJHso (ORCPT ); Wed, 10 Jun 2015 03:48:44 -0400 Received: from www.osadl.org ([62.245.132.105]:32964 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933233AbbFJHsb (ORCPT ); Wed, 10 Jun 2015 03:48:31 -0400 From: Nicholas Mc Guire To: Mauro Carvalho Chehab Cc: Christopher Reimer , Markus Elfring , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] [media] ddbridge: fix wait_event_timeout return handling Date: Wed, 10 Jun 2015 09:40:02 +0200 Message-Id: <1433922002-22971-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1803 Lines: 50 API conformance testing for completions with coccinelle spatches are being used to locate API usage inconsistencies: ./drivers/media/pci/ddbridge/ddbridge-core.c:89 incorrect check for negative return Return type of wait_event_timeout is signed long not int and the return type is >=0 always thus the negative check is unnecessary.. As stat is used here exclusively its type is simply changed and the negative return check dropped. Signed-off-by: Nicholas Mc Guire --- Patch was compile tested with x86_64_defconfig + CONFIG_MEDIA_SUPPORT=m, MEDIA_DIGITAL_TV_SUPPORT=y, CONFIG_MEDIA_PCI_SUPPORT=y, CONFIG_DVB_DDBRIDGE=m Patch is against 4.1-rc7 (localversion-next is -next-20150609) drivers/media/pci/ddbridge/ddbridge-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/pci/ddbridge/ddbridge-core.c b/drivers/media/pci/ddbridge/ddbridge-core.c index 9e3492e..7f1b3b3 100644 --- a/drivers/media/pci/ddbridge/ddbridge-core.c +++ b/drivers/media/pci/ddbridge/ddbridge-core.c @@ -81,13 +81,13 @@ static int i2c_read_reg16(struct i2c_adapter *adapter, u8 adr, static int ddb_i2c_cmd(struct ddb_i2c *i2c, u32 adr, u32 cmd) { struct ddb *dev = i2c->dev; - int stat; + long stat; u32 val; i2c->done = 0; ddbwritel((adr << 9) | cmd, i2c->regs + I2C_COMMAND); stat = wait_event_timeout(i2c->wq, i2c->done == 1, HZ); - if (stat <= 0) { + if (stat == 0) { printk(KERN_ERR "I2C timeout\n"); { /* MSI debugging*/ u32 istat = ddbreadl(INTERRUPT_STATUS); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/