Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp1761378ybm; Thu, 23 May 2019 06:25:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyq+BkvQ60Q1qVvZKwfMps62eF4GcJxpjvFFAmVzN3+8Ki0fjUJd773EYFNcueSWg+3UMPH X-Received: by 2002:a63:1224:: with SMTP id h36mr5921694pgl.9.1558617928780; Thu, 23 May 2019 06:25:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558617928; cv=none; d=google.com; s=arc-20160816; b=SoQlkpRy1EkAuFvcw6k/e2m1at/5FmGIZIVwWkafUhAOei2f2JKcdPVITmOQu4n8L6 7OlfoulFh+7U1xdLRcIdYjXcilp3RvLyiCfQmjhVfM5R1Yufkhx1a3tUnLT7YSqdLmGJ 9nOJgWOBfstavyxrl2Pl0XyzyqI+IuzP0jkkKbmnsMcWGqW2osA2ULa8YDXXvlRLQVOn YMAAm5kZWLY8wjjb5LbU3e+mm8t9dpPs8f6HrygM4UX5U4fB5qsv0mfHBdj9blnxDSS7 1+Q5hjF7JxomwnnA9hd2+DnuP5IDkJx4Yh+M6WpFIvwg7xQQDN1z3UnsbXcvfw7bHb+D fSzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IXUSqhWKpNXueUwu9xgWPW4SvpSlIVLK8VFFvoIyjkg=; b=CMXUVNUvA8LgdVjNeXKcSdqxKn3K1plqr9bKn87YbZ3JbIqbWupQieFZUVYp3W4sCk TtQ6/EQfXeu6v6Rzjh3gjjAcrUVanUNFuuTQM0ffEvQRGMThw+S0pLti85l6TCd4P1G2 ucv/qpgOoGQVy+9QcDfTrebstFoL9WP2Nr2J5t4TY7jlI+7trG0ScBNErcMEy72khHj/ P+WlsL1HqDhwIQcPUKmtXGvTcpuCqt7Tb1fLKCXcplgRmijSGRgCBkE3NT7rxg8Kn0WA o1Vb6Hy6f46+L5GxnJyd6W0MMSdo9UVR1zeqYb6YX2XwEYbfA4vFPtz6xZJZJ/76SY/L aCXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UhXIhYmR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z6si29202956pgp.35.2019.05.23.06.25.11; Thu, 23 May 2019 06:25:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UhXIhYmR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730685AbfEWNXt (ORCPT + 99 others); Thu, 23 May 2019 09:23:49 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45051 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbfEWNXt (ORCPT ); Thu, 23 May 2019 09:23:49 -0400 Received: by mail-pg1-f196.google.com with SMTP id n2so3131708pgp.11 for ; Thu, 23 May 2019 06:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXUSqhWKpNXueUwu9xgWPW4SvpSlIVLK8VFFvoIyjkg=; b=UhXIhYmRzGdKbWHnMSc3BMSk3wEnttvhYKdLEMp20gS9zTefkW2BOKc5AnyTN+6WhN /96S+JyibDLOQfU1wEgDdPzWZMSRl9vqUuMFPgBBfOsFLktykrnSx9Nyd8Fi8n1DmbDY QIHKbSzRG1rPVOT4GwHR3u7bLZ3x4XWVUf0oh7KFGouuJ1hASRk+F+iAG4Bt5oZlPMua H/YwLkJOvjj4fPxYLeryTL3YN35mAppJU9tMErHPWqpwKZiyhE1FC6OkNDeibT5e3Fc3 kOjB6wCq5FL+GUyZLwNdXoulYKLpqHPJkSSIBpWpFAi3dThhudXCC5mZtChFdHuKd5C+ A3RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXUSqhWKpNXueUwu9xgWPW4SvpSlIVLK8VFFvoIyjkg=; b=dzLJC5aePE7LxpJHUciF3ZzJ+OOqalC5RIKYmZ0mgIVms2vOabQXWcTHgefbFbq+Eg CEoI9umWlKnK8CsfwDTak1ly9CHbVOqm6mHWIw1zmT3UElSScBO4eK6viKVjl/ohI3Ru 5/Yl34jLTVi4k0sIIvs/PFOn8mbi/kU8QQt/Ke99qbUszcHv6iHQBITd98D7Kj3vQQNd RbsBOLrz9nrLPur40NnVp09h1oZlhFSXaqOUgJZ9qBam55zxWLHtcWYd8PD2PKP/mBSM lRdrnOmB8Wn2QRJIh4jzBdXnJ03+7eQHp/9kUVFF0ERNPTOJaba9hGc/Im7lrMq9WxWf 2x0A== X-Gm-Message-State: APjAAAUNhGpW2lPKInQ3SI6U2kbnVoJQucqsh/src4TMUAhWYpGnqQFR 6iMJijUq31nhZSzDIwLrNgg= X-Received: by 2002:a62:2b94:: with SMTP id r142mr13112527pfr.184.1558617828679; Thu, 23 May 2019 06:23:48 -0700 (PDT) Received: from localhost.localdomain ([122.163.94.48]) by smtp.gmail.com with ESMTPSA id f36sm35845239pgb.76.2019.05.23.06.23.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 May 2019 06:23:48 -0700 (PDT) From: Nishka Dasgupta To: gregkh@linuxfoundation.org, christian.gromm@microchip.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Cc: Nishka Dasgupta Subject: [PATCH] staging: most: usb: Remove variable frame_size Date: Thu, 23 May 2019 18:53:34 +0530 Message-Id: <20190523132334.29611-1-nishkadg.linux@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove variable frame_size as its multiple usages are all independent of each other and so can be returned separately. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta --- drivers/staging/most/usb/usb.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/most/usb/usb.c b/drivers/staging/most/usb/usb.c index 360cb5b7a10b..751e82cf66c5 100644 --- a/drivers/staging/most/usb/usb.c +++ b/drivers/staging/most/usb/usb.c @@ -186,32 +186,28 @@ static inline int start_sync_ep(struct usb_device *usb_dev, u16 ep) */ static unsigned int get_stream_frame_size(struct most_channel_config *cfg) { - unsigned int frame_size = 0; unsigned int sub_size = cfg->subbuffer_size; if (!sub_size) { pr_warn("Misconfig: Subbuffer size zero.\n"); - return frame_size; + return 0; } switch (cfg->data_type) { case MOST_CH_ISOC: - frame_size = AV_PACKETS_PER_XACT * sub_size; - break; + return AV_PACKETS_PER_XACT * sub_size; case MOST_CH_SYNC: if (cfg->packets_per_xact == 0) { pr_warn("Misconfig: Packets per XACT zero\n"); - frame_size = 0; + return 0; } else if (cfg->packets_per_xact == 0xFF) { - frame_size = (USB_MTU / sub_size) * sub_size; + return (USB_MTU / sub_size) * sub_size; } else { - frame_size = cfg->packets_per_xact * sub_size; + return cfg->packets_per_xact * sub_size; } - break; default: pr_warn("Query frame size of non-streaming channel\n"); - break; + return 0; } - return frame_size; } /** -- 2.19.1