From patchwork Sun Jan 28 16:13:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 13534526 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99228C47DA9 for ; Sun, 28 Jan 2024 16:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F9+PWn8Lr8rT2cHAiqXDssm6ih3uMcLDs343F2b/HUc=; b=XPCxDI4mHOoIxw 7/BrLx7xYufcwkGBYBSG5j5daic33RiZKLmoruXrb+62VUZ7x/itTwtBbncOrYT3RijRNWUUVI5Ja DLZFDE9HgFef9ArzXF++5gn1NuZV3Vqi1OUCFzZdO8NBkUifEl9aUiFKB4aqC464tHVlPN09Bf3Qs kRrouklBn6fDnkKLtdTXPZAHQ/+OjYm+CNEdtpBHnB7Nxt8a4fdBF9tuLtT64FH5HZpGh45+cSJ+O zKWz3TDXGmb6Msiep5lhBEbUy4MiCcMWN6bUULIA9NXM45zI5gIlP4llXdKaI41UvgNEkkRDeEl/T lHpztebgeVskBUor+Lcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rU7nO-00000009qJw-2d85; Sun, 28 Jan 2024 16:14:10 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rU7nJ-00000009qFz-3CYe for linux-arm-kernel@lists.infradead.org; Sun, 28 Jan 2024 16:14:07 +0000 Received: by mail-qv1-xf35.google.com with SMTP id 6a1803df08f44-686a92a8661so16249366d6.0 for ; Sun, 28 Jan 2024 08:14:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1706458444; x=1707063244; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0m/P1zm+p3BLtEev+qUE8lpx92ojld2E2PJGrd3/bdc=; b=Odqqp/JO3kJ7nVZIaODaSyG0/BdsPZZTXb2Zvw4XKudLmVPxg5j0wlBdIY2vsvzy6M wHR4ifMTD8X5sKpr/N/Z9kun7zjbCeJ7JPRPtDKsjSGuQw02KOaW7WnKNT888nn6ayaA BcVDkVQnikKqoO2G1FEqu/Adbr4rV5fNVzerk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706458444; x=1707063244; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0m/P1zm+p3BLtEev+qUE8lpx92ojld2E2PJGrd3/bdc=; b=j7rX9OzieHDM6c5gP4eEOuQL1ajmAc62ksq3EIdS415It2y1YDrVoPnIRDx4txQgZf zlH42WHWs4mY/FJSeLZHdeq4r7vXTKie0rQnqZmxIN4iGtDbZTDqvzfwVpc1LwEYproT g4WSvLrA5chIJ2XhBDiEQTEqaZYgzJAEK67Rn/6Oy6lP54k6SYQtB7j0KiIAW/1ImL8Z 3EmTzrMvvpMNy8NTr4z+P4EGnBMyHkDcSg25J8X0e7uqDlHlVGuzOQCZJRKbFSMhpf3/ qMWYU85w2v6WcbvUJT9OgAtXc2P3j5lYAXCs0b/9I0nP+jrKJx56Hz7yVVSJnwxDYZxi u//Q== X-Gm-Message-State: AOJu0YxaifSmvcWsJLz7MSrfn+P1yYPpMympPY9p64BbCB+F/1MMIjef SKgGzLGprhPCsX+E09H28wcLIUiW2YnUIhY58QyFMOMpPpEEuTh3VrcgNcScew== X-Google-Smtp-Source: AGHT+IFpFnYrtsvv/PZSGrHMTLLAsQo9nx3jvGx+Qy0aib/OUFMOdMy+oEDsUYYR6HbDZ0N/K9VkLw== X-Received: by 2002:a05:6214:e88:b0:685:5639:fb1a with SMTP id hf8-20020a0562140e8800b006855639fb1amr5171396qvb.102.1706458444437; Sun, 28 Jan 2024 08:14:04 -0800 (PST) Received: from denia.c.googlers.com (240.157.150.34.bc.googleusercontent.com. [34.150.157.240]) by smtp.gmail.com with ESMTPSA id dz11-20020ad4588b000000b0068c493426edsm566640qvb.104.2024.01.28.08.14.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 08:14:03 -0800 (PST) From: Ricardo Ribalda Date: Sun, 28 Jan 2024 16:13:57 +0000 Subject: [PATCH 2/2] media: usb: s2255: Refactor s2255_get_fx2fw MIME-Version: 1.0 Message-Id: <20240128-gcc-11-warnings-v1-2-52bbdf492049@chromium.org> References: <20240128-gcc-11-warnings-v1-0-52bbdf492049@chromium.org> In-Reply-To: <20240128-gcc-11-warnings-v1-0-52bbdf492049@chromium.org> To: Laurent Pinchart , Mauro Carvalho Chehab , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.12.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240128_081405_892094_E9C37AF5 X-CRM114-Status: GOOD ( 11.44 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Resize the buffer to the actual size needed and initialize it. With this we can convince gcc-11 that the variable is not used uninitialized. drivers/media/usb/s2255/s2255drv.c:1914:25: warning: 'transBuffer' may be used uninitialized [-Wmaybe-uninitialized] Signed-off-by: Ricardo Ribalda --- drivers/media/usb/s2255/s2255drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 3c2627712fe9..8e1de1e8bd12 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -1906,9 +1906,10 @@ static int s2255_get_fx2fw(struct s2255_dev *dev) { int fw; int ret; - unsigned char transBuffer[64]; - ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer, 2, - S2255_VR_IN); + u8 transBuffer[2] = {}; + + ret = s2255_vendor_req(dev, S2255_VR_FW, 0, 0, transBuffer, + sizeof(transBuffer), S2255_VR_IN); if (ret < 0) dprintk(dev, 2, "get fw error: %x\n", ret); fw = transBuffer[0] + (transBuffer[1] << 8);