From patchwork Sat May 31 16:30:52 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: 4276281 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 0B6E3BEEA7 for ; Sat, 31 May 2014 16:31:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2D0E220123 for ; Sat, 31 May 2014 16:31:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 517072010C for ; Sat, 31 May 2014 16:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752180AbaEaQbH (ORCPT ); Sat, 31 May 2014 12:31:07 -0400 Received: from mail-vc0-f171.google.com ([209.85.220.171]:48663 "EHLO mail-vc0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751514AbaEaQbG (ORCPT ); Sat, 31 May 2014 12:31:06 -0400 Received: by mail-vc0-f171.google.com with SMTP id lc6so3469494vcb.30 for ; Sat, 31 May 2014 09:31:04 -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=EEqFIpIEHyUJzlnUlRjf+/btkoI8Q6zl3TJtIrEqfaQ=; b=sFKTYh5HEdpwr2knIzLBkhm1cP3w6JTKPrPOh9UJ/K3Wr9r8FaSPA8GLto/YJ8TTYn lhbgZfTPj85buV7GGWrH5f0abx2wr4Xzytu96UJBQwIUShJFEr8/FZI7o20kdORdWh4v BFhSkv6qc5mI2X7l/QKBGzovGj8ztsTvLsV6IOjY/KKYj8cP2AsgvcKMRjCX6VdyG3uf hWyTjLr9vGtA58KWUV1M2xQiYB2vy8WugPqfSNaCjNBkNHXSgSp8id4mv/X9sZmJFkI6 DSViNDcij8ThDnoSE0NmK7NUar+m9O3eLrbm1mGmdtllKAlQvo7aFhfSBHgXbe8II+kG DoFg== X-Received: by 10.221.44.73 with SMTP id uf9mr20640715vcb.9.1401553864344; Sat, 31 May 2014 09:31:04 -0700 (PDT) Received: from localhost.localdomain ([201.45.91.211]) by mx.google.com with ESMTPSA id om10sm7971013vec.9.2014.05.31.09.31.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 May 2014 09:31:03 -0700 (PDT) From: Peter Senna Tschudin To: Mauro Carvalho Chehab Cc: kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 9/11 V2] drivers/media: Remove useless return variables Date: Sat, 31 May 2014 13:30:52 -0300 Message-Id: <1401553852-13753-1-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 --- Changes from V1: - Do not remove comment after the definition of return variable drivers/media/pci/ngene/ngene-core.c | 11 ++--------- drivers/media/usb/cx231xx/cx231xx-video.c | 11 +++++------ 2 files changed, 7 insertions(+), 15 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/pci/ngene/ngene-core.c b/drivers/media/pci/ngene/ngene-core.c index 970e833..826228c 100644 --- a/drivers/media/pci/ngene/ngene-core.c +++ b/drivers/media/pci/ngene/ngene-core.c @@ -910,7 +910,6 @@ static int AllocateRingBuffers(struct pci_dev *pci_dev, { dma_addr_t tmp; u32 i, j; - int status = 0; u32 SCListMemSize = pRingBuffer->NumBuffers * ((Buffer2Length != 0) ? (NUM_SCATTER_GATHER_ENTRIES * 2) : NUM_SCATTER_GATHER_ENTRIES) @@ -1010,14 +1009,12 @@ static int AllocateRingBuffers(struct pci_dev *pci_dev, } - return status; + return 0; } static int FillTSIdleBuffer(struct SRingBufferDescriptor *pIdleBuffer, struct SRingBufferDescriptor *pRingBuffer) { - int status = 0; - /* Copy pointer to scatter gather list in TSRingbuffer structure for buffer 2 Load number of buffer @@ -1038,7 +1035,7 @@ static int FillTSIdleBuffer(struct SRingBufferDescriptor *pIdleBuffer, pIdleBuffer->Head->ngeneBuffer.Number_of_entries_1; Cur = Cur->Next; } - return status; + return 0; } static u32 RingBufferSizes[MAX_STREAM] = { diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 1f87513..cba7fea 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -208,7 +208,7 @@ static inline void get_next_buf(struct cx231xx_dmaqueue *dma_q, static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) { struct cx231xx_dmaqueue *dma_q = urb->context; - int i, rc = 1; + int i; unsigned char *p_buffer; u32 bytes_parsed = 0, buffer_size = 0; u8 sav_eav = 0; @@ -299,13 +299,12 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) bytes_parsed = 0; } - return rc; + return 1; } static inline int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb) { struct cx231xx_dmaqueue *dma_q = urb->context; - int rc = 1; unsigned char *p_buffer; u32 bytes_parsed = 0, buffer_size = 0; u8 sav_eav = 0; @@ -379,7 +378,7 @@ static inline int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb) bytes_parsed = 0; } - return rc; + return 1; } @@ -1620,7 +1619,7 @@ static int radio_s_tuner(struct file *file, void *priv, const struct v4l2_tuner */ static int cx231xx_v4l2_open(struct file *filp) { - int errCode = 0, radio = 0; + int radio = 0; struct video_device *vdev = video_devdata(filp); struct cx231xx *dev = video_drvdata(filp); struct cx231xx_fh *fh; @@ -1718,7 +1717,7 @@ static int cx231xx_v4l2_open(struct file *filp) mutex_unlock(&dev->lock); v4l2_fh_add(&fh->fh); - return errCode; + return 0; } /*