From patchwork Thu Jan 23 10:28:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 3527331 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A194DC02DC for ; Thu, 23 Jan 2014 10:28:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B480C2018B for ; Thu, 23 Jan 2014 10:28:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0E784201B6 for ; Thu, 23 Jan 2014 10:28:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752878AbaAWK2b (ORCPT ); Thu, 23 Jan 2014 05:28:31 -0500 Received: from smtp-out003.kontent.com ([81.88.40.217]:33404 "EHLO smtp-out003.kontent.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751648AbaAWK2a (ORCPT ); Thu, 23 Jan 2014 05:28:30 -0500 Received: from linux-fkkt.site (p50894C18.dip0.t-ipconnect.de [80.137.76.24]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: neukum_org@smtp-out003.kontent.com) by smtp-out003.kontent.com (Postfix) with ESMTPSA id 20FFA40004BC; Thu, 23 Jan 2014 11:28:28 +0100 (CET) From: oliver@neukum.org To: laurent.pinchart@ideasonboard.com, linux-media@vger.kernel.org Cc: Oliver Neukum Subject: [PATCH] uvc: simplify redundant check Date: Thu, 23 Jan 2014 11:28:24 +0100 Message-Id: <1390472905-29586-1-git-send-email-oliver@neukum.org> X-Mailer: git-send-email 1.8.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Oliver Neukum x < constant implies x + unsigned < constant That check just obfuscates the code Signed-off-by: Oliver Neukum Acked-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index c3bb250..b6cac17 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -925,7 +925,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev, case UVC_VC_HEADER: n = buflen >= 12 ? buffer[11] : 0; - if (buflen < 12 || buflen < 12 + n) { + if (buflen < 12 + n) { uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " "interface %d HEADER error\n", udev->devnum, alts->desc.bInterfaceNumber);