From patchwork Sat May 31 13:14:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 4275551 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 08E809F1D6 for ; Sat, 31 May 2014 13:16:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 33BFD20200 for ; Sat, 31 May 2014 13:16:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FBB6201F2 for ; Sat, 31 May 2014 13:16:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933348AbaEaNQF (ORCPT ); Sat, 31 May 2014 09:16:05 -0400 Received: from mail-ve0-f174.google.com ([209.85.128.174]:37142 "EHLO mail-ve0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933196AbaEaNOo (ORCPT ); Sat, 31 May 2014 09:14:44 -0400 Received: by mail-ve0-f174.google.com with SMTP id jw12so3388971veb.19 for ; Sat, 31 May 2014 06:14:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=hNcMTJqG7wydtF5LcPZqzmm2OBqx5mUrbmIeuR1NTCo=; b=PqkKnE/KaYoiqlbPOVRavbGZ4qlXJD+vzA8CW70R3EIViJvpVASo17AfCOy7DivaTy 7K95GDnJ7SnsQWOdE46+/hhb5buSsMETLlmskt2RtRSyYTaOj/xvH+yvwnfJVOtNlLF8 B/sdDGjsuOMxnNBu9JD20KViswVR+Ep2A6WboQGYLWAx7drcTVzZWV/xjqMM8Jh8ltzN Yd9Zhs2eMpdWNF3dy1JfUbvHMj/PTdhtIR6dQ9dl58OL1iE0IL5p+l76wZlRMHKxW/hi GM44cDiK2J/NW6OtbYu1hqKTEenwlW4WLBVqa+knbd6oLHmBCLD7Fr5tmJ5zlU3WgrzM wqVg== X-Received: by 10.52.76.134 with SMTP id k6mr308113vdw.62.1401542084168; Sat, 31 May 2014 06:14:44 -0700 (PDT) Received: from localhost.localdomain ([201.45.91.211]) by mx.google.com with ESMTPSA id qr20sm12174405vdb.21.2014.05.31.06.14.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 May 2014 06:14:43 -0700 (PDT) From: Peter Senna Tschudin To: Hans Verkuil Cc: kernel-janitors@vger.kernel.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/11] drivers/media/usb/usbvision/usbvision-core.c: Remove useless return variables Date: Sat, 31 May 2014 10:14:08 -0300 Message-Id: <1401542051-3174-8-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch remove variables that are initialized with a constant, are never updated, and are only used as parameter of return. Return the constant instead of using a variable. Verified by compilation only. The coccinelle script that find and fixes this issue is: // @@ type T; constant C; identifier ret; @@ - T ret = C; ... when != ret when strict return - ret + C ; // Signed-off-by: Peter Senna Tschudin --- drivers/media/usb/usbvision/usbvision-core.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c index 816b1cf..302aa07 100644 --- a/drivers/media/usb/usbvision/usbvision-core.c +++ b/drivers/media/usb/usbvision/usbvision-core.c @@ -1463,8 +1463,6 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision, int address, static int usbvision_init_compression(struct usb_usbvision *usbvision) { - int err_code = 0; - usbvision->last_isoc_frame_num = -1; usbvision->isoc_data_count = 0; usbvision->isoc_packet_count = 0; @@ -1475,7 +1473,7 @@ static int usbvision_init_compression(struct usb_usbvision *usbvision) usbvision->request_intra = 1; usbvision->isoc_measure_bandwidth_count = 0; - return err_code; + return 0; } /* this function measures the used bandwidth since last call @@ -1484,11 +1482,9 @@ static int usbvision_init_compression(struct usb_usbvision *usbvision) */ static int usbvision_measure_bandwidth(struct usb_usbvision *usbvision) { - int err_code = 0; - if (usbvision->isoc_measure_bandwidth_count < 2) { /* this gives an average bandwidth of 3 frames */ usbvision->isoc_measure_bandwidth_count++; - return err_code; + return 0; } if ((usbvision->isoc_packet_size > 0) && (usbvision->isoc_packet_count > 0)) { usbvision->used_bandwidth = usbvision->isoc_data_count / @@ -1499,7 +1495,7 @@ static int usbvision_measure_bandwidth(struct usb_usbvision *usbvision) usbvision->isoc_data_count = 0; usbvision->isoc_packet_count = 0; usbvision->isoc_skip_count = 0; - return err_code; + return 0; } static int usbvision_adjust_compression(struct usb_usbvision *usbvision) @@ -1546,26 +1542,24 @@ static int usbvision_adjust_compression(struct usb_usbvision *usbvision) static int usbvision_request_intra(struct usb_usbvision *usbvision) { - int err_code = 0; unsigned char buffer[1]; PDEBUG(DBG_IRQ, ""); usbvision->request_intra = 1; buffer[0] = 1; usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); - return err_code; + return 0; } static int usbvision_unrequest_intra(struct usb_usbvision *usbvision) { - int err_code = 0; unsigned char buffer[1]; PDEBUG(DBG_IRQ, ""); usbvision->request_intra = 0; buffer[0] = 0; usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); - return err_code; + return 0; } /*******************************