From patchwork Wed Jun 10 12:58:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Mc Guire X-Patchwork-Id: 6579771 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D5A8E9F3D1 for ; Wed, 10 Jun 2015 13:07:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F34CC20416 for ; Wed, 10 Jun 2015 13:07:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BDD23202A1 for ; Wed, 10 Jun 2015 13:07:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B99A6E8CA; Wed, 10 Jun 2015 06:07:00 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from www.osadl.org (www.osadl.org [62.245.132.105]) by gabe.freedesktop.org (Postfix) with ESMTP id 92B416E8C6 for ; Wed, 10 Jun 2015 06:06:58 -0700 (PDT) Received: from debian.hofr.at (92-243-35-153.adsl.nanet.at [92.243.35.153] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id t5AD6kI7023401; Wed, 10 Jun 2015 15:06:47 +0200 From: Nicholas Mc Guire To: Russell King Subject: [PATCH RFC] drm/i2c: tda998x: dead-code or unhandled error condition ? Date: Wed, 10 Jun 2015 14:58:48 +0200 Message-Id: <1433941128-19798-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 1.7.10.4 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Nicholas Mc Guire X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP event API conformance testing with coccinelle spatches are being used to locate API usage inconsistencies this triggert with: ./drivers/gpu/drm/i2c/tda998x_drv.c:1062 incorrect check for negative return The return of wait_event_timeout is always >= 0, thus the negative check was effectively being ignoring - as the timeout will be checked a few lines below the error condition being checked here seems to be wrong or this is simply dead code which would be my guess as the timeout condition check covers the wait-queue related failure condition. Signed-off-by: Nicholas Mc Guire Acked-by: Jean-Francois Moine --- Can't really determine what the right fix for this would be - someone that knows this driver would need to check - in any case the current code seems broken. Patch was compile tested with x86_64_defconfig + CONFIG_DRM_I2C_SIL164=m Patch is against 4.1-rc7 (localversion-next is -next-20150610) drivers/gpu/drm/i2c/tda998x_drv.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index fe1599d..d489a6e 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1065,10 +1065,6 @@ static int read_edid_block(void *data, u8 *buf, unsigned int blk, size_t length) i = wait_event_timeout(priv->wq_edid, !priv->wq_edid_wait, msecs_to_jiffies(100)); - if (i < 0) { - dev_err(&priv->hdmi->dev, "read edid wait err %d\n", i); - return i; - } } else { for (i = 100; i > 0; i--) { msleep(1);