From patchwork Fri Apr 3 13:16:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 11472665 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D440A15AB for ; Fri, 3 Apr 2020 13:22:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3046208FE for ; Fri, 3 Apr 2020 13:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585920151; bh=WqfXIrmWWvxJbbjVxq8Ax+aX7FyrSzMmutGDKxcL97g=; h=From:To:Cc:Subject:Date:List-ID:From; b=SRAPWjkBlct6PXXPttEKdKVNOdAPK6ema5sdPBo2keTAFW76ZT+zJVL1HvfHLiN9/ OPoHZFOrqk3QCXyPbiRCE4fi1J/0/NblvyLFm8cRwiBHa2SyDRQ/B8ZBcxG4IoiD8v ac9KsAO8Cvbk+kZlgvW//XaHiGz2iE+EvWZM+rvg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728133AbgDCNWb (ORCPT ); Fri, 3 Apr 2020 09:22:31 -0400 Received: from condef-03.nifty.com ([202.248.20.68]:30548 "EHLO condef-03.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727923AbgDCNWa (ORCPT ); Fri, 3 Apr 2020 09:22:30 -0400 Received: from conuserg-07.nifty.com ([10.126.8.70])by condef-03.nifty.com with ESMTP id 033DIj52017366 for ; Fri, 3 Apr 2020 22:18:45 +0900 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id 033DH9t9027909; Fri, 3 Apr 2020 22:17:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com 033DH9t9027909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1585919830; bh=6SNvN4uZsUHdhQ28mSp8KyStQBpxyYCWP8kC6l/eSfI=; h=From:To:Cc:Subject:Date:From; b=uhYpip08oTMfdfXf8KHL6QegqkNA6gfAiFvhui0ahYMcbzpxCL2l+0kBcYQ/mrruC lHlvf61boJqmhqeXKM3t6CD4m6rQKDVyYi/7WNYY74AK/KCNYdm9w85nR0Sbx6cJfg 8M6Zg39W3WGHxd2K+3YYXbg3G5qo24s9ZBJo3eSLQUKFVK5tDG9sgSFD8S9rxL7Jzg 89AGfwjYIB3TSWE0HADxvPqIe7jKFrQqDLQO/AiV5xCb3kim7DrCfghjmgGPImLw2k pgONRMfdu6j3FQ/PIUKsWrAYWGi8CJOXcMtMNCFQxxUzk5UAN2ShA0EEyeG16nu0x6 9PgHAHnK3q3Aw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Felipe Balbi , linux-usb@vger.kernel.org Cc: Greg KH , Masahiro Yamada , Corentin Labbe , David Howells , Felipe Balbi , "Peter Zijlstra (Intel)" , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: [PATCH] usb: gadget: legacy: fix redundant initialization warnings from cppcheck Date: Fri, 3 Apr 2020 22:16:51 +0900 Message-Id: <20200403131652.8183-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.17.1 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Fix the following cppcheck warnings: drivers/usb/gadget/legacy/inode.c:1364:8: style: Redundant initialization for 'value'. The initialized value is overwritten$ value = -EOPNOTSUPP; ^ drivers/usb/gadget/legacy/inode.c:1331:15: note: value is initialized int value = -EOPNOTSUPP; ^ drivers/usb/gadget/legacy/inode.c:1364:8: note: value is overwritten value = -EOPNOTSUPP; ^ drivers/usb/gadget/legacy/inode.c:1817:8: style: Redundant initialization for 'value'. The initialized value is overwritten$ value = -EINVAL; ^ drivers/usb/gadget/legacy/inode.c:1787:18: note: value is initialized ssize_t value = len, length = len; ^ drivers/usb/gadget/legacy/inode.c:1817:8: note: value is overwritten value = -EINVAL; ^ Reported-by: kbuild test robot Signed-off-by: Masahiro Yamada Acked-by: Alan Stern --- I do not think this is my fault because the addressed commit did not touch this file, but the kbuild test robot sent me this report somehow: https://lkml.org/lkml/2020/4/3/395 Anyway, the warnings are real, so I removed the redundant assignments. I re-ran cppcheck and confirmed the warnings have been fixed. drivers/usb/gadget/legacy/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/legacy/inode.c b/drivers/usb/gadget/legacy/inode.c index aa0de9e35afa..3afddd3bea6e 100644 --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -1361,7 +1361,6 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl) req->buf = dev->rbuf; req->context = NULL; - value = -EOPNOTSUPP; switch (ctrl->bRequest) { case USB_REQ_GET_DESCRIPTOR: @@ -1784,7 +1783,7 @@ static ssize_t dev_config (struct file *fd, const char __user *buf, size_t len, loff_t *ptr) { struct dev_data *dev = fd->private_data; - ssize_t value = len, length = len; + ssize_t value, length = len; unsigned total; u32 tag; char *kbuf;