From patchwork Fri Apr 7 09:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 671018 Delivered-To: patch@linaro.org Received: by 2002:a5d:4d08:0:0:0:0:0 with SMTP id z8csp224569wrt; Fri, 7 Apr 2023 02:13:15 -0700 (PDT) X-Google-Smtp-Source: AKy350Yf+xrAkyJvqiSr98Za0HIVoQlXYlbq9k/YUgFc8NajvhhhurfCtT/r+8Z895g25Esq+1E1 X-Received: by 2002:a92:d30b:0:b0:324:75b1:6499 with SMTP id x11-20020a92d30b000000b0032475b16499mr1010488ila.18.1680858795467; Fri, 07 Apr 2023 02:13:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680858795; cv=none; d=google.com; s=arc-20160816; b=Cvn7ScCuLxpbwZSQAYwwMK8KP/znHTY0q/RwwHbkKEiCI5FY7RERiL00QNZCykLVu9 CMP5skRLQtcbLt2+XNQpKnARWMrwuajMZqk7cfV28hmqDoEwKxf1C8WEfRgTU1hktB+N v28BKT2RRRcxo/9ufH7PSeh5R453rGybLP0A56lPvi5M2lcqhXEQH4+0k3le23YN/XUk 70OZQV0WwiALrTKKaMnD/L7m37ivmZJm0NR0MxhF1eM2KZd4MF6dX5y8aenw4aigqC5Q nXQFGTDZdT6WUHzZUFuu9xeoTWYRexjV18rqyt2v7OVIRkidNGAK3i1HZaVpxTpYbl7k QDtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=x4eekiMQvOol26MKElpD3A/3n1V1+PfJrQnmdFWhxlg=; b=JWib6LxryvFH/7qu+MD654Ozft/G3IVV6plAEX7FHaAWEJ7dn5Rf9u5QpZAiyt5Ap0 Hg8csrOA/1ZuT3VpiwfO5DAoontWQ6DfdchkgIw0pqTIziW/yDJa9PkKkUsoPh6dQVXS Xn58Fp9CpDX0k5Wf7FfzWeC8FmwivA25azxW5KDAoEFp/NNVnlDor3P5ZwpCUATCEBiU CwPIm2ONde6A79J5azBAc/G1L7CK3miS7XfXqeI58LPpFeqEJ/Ijt/Po0uh3SzUYWIex Z3audXotf1rFZdWlVGk57UVWrfMa/hVLKCbDnh3sQomg4k7DDaDaRoVOjaoiRalabKa9 Dhhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FK1CWM4C; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id d20-20020a056e020c1400b0031703f4c5b1si2477018ile.128.2023.04.07.02.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 02:13:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FK1CWM4C; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75268860A4; Fri, 7 Apr 2023 11:13:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="FK1CWM4C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 681BC860DD; Fri, 7 Apr 2023 11:13:10 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C0B98860A1 for ; Fri, 7 Apr 2023 11:13:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org Received: by mail-ej1-x62d.google.com with SMTP id cw23so7103511ejb.12 for ; Fri, 07 Apr 2023 02:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680858787; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=x4eekiMQvOol26MKElpD3A/3n1V1+PfJrQnmdFWhxlg=; b=FK1CWM4CxssDvoE4hkyxfmKm2I36n3POYVVauFPep+PAL3fa4qfL05aNNTyzgpSYTr /Gicmwm2OGNB2Ag/V4elTOIscoP7id0YZGdqac5R2+M2LF2gGtxxKPfixjv0lT5VRWrv Br5upNFcANxk2LsGGaQLilVM6QnTVR+o5HSSGewb7afNMv5Wm34I9OfWrIa5NjgtFtWA q/ueoMI5BwV1A6gFsMKQYUTDYr5WyoMqDzcK071iPENY0/yaDedEjQfQm6DvDN4ndpCK HQkulidNU4gsFsxA0UT8dLAD5pKFnyonq+YZpJ5xYYtsNgCCuZdS4tFOYuyTfKEvf27U trIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680858787; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x4eekiMQvOol26MKElpD3A/3n1V1+PfJrQnmdFWhxlg=; b=6cbAjrvGwUg3w60oeuxeOJ+gxe+2SfGxk7EBeDGWkwd96In8N2orqVvyblJjI7Mb07 76kvdX25OfZz5fZI3Ewz3Ko5qmE7SjlD6GHpiv93gEU6K6APv4AB9p+/hoi0PlFUTrDF 4eqS4zS9oytDo4wxwEg94rbyxoSFlYjlKX5KK5/LIDiO9RwVhTpOC4+YdPM4WexzPmxD a7iMXSadjmKeiPrnP/2Cpcke9x+0TVo14h4B0Y0xBPPklgP3YiBLyePkXHNvKwhuXezg F5QVzUJX8Tp+XBqEYW5sO5u+5Zt+1v0ORuLCUXCGh7Lh1wFjKSj4UQjxEcT6WqIl18K0 99zA== X-Gm-Message-State: AAQBX9e52T8UX/OOZXR8weF1QTU1kJQQ3/DbPMz0qHOUuTihPpEUonNd s2wh3dajzN7F/Ul4g0dBnk0BiwN0AqRb2cie2E8= X-Received: by 2002:a17:906:7c58:b0:92f:f655:cc78 with SMTP id g24-20020a1709067c5800b0092ff655cc78mr1824884ejp.53.1680858787293; Fri, 07 Apr 2023 02:13:07 -0700 (PDT) Received: from localhost.localdomain (ppp176092130041.access.hol.gr. [176.92.130.41]) by smtp.gmail.com with ESMTPSA id jx25-20020a170907761900b00932ab7699ffsm1867859ejc.148.2023.04.07.02.13.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Apr 2023 02:13:06 -0700 (PDT) From: Ilias Apalodimas To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Jassi Brar , Jagan Teki Subject: [PATCH] spi: synquacer: Silence unused variable warnings Date: Fri, 7 Apr 2023 12:13:00 +0300 Message-Id: <20230407091300.2316694-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean When building with clang, the compiler compains with drivers/spi/spi-synquacer.c:212:11: warning: variable 'bus_width' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] else if (priv->mode & SPI_TX_OCTAL) ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-synquacer.c:276:11: note: uninitialized use occurs here val |= ((bus_width >> 1) << BUS_WIDTH); ^~~~~~~~~ drivers/spi/spi-synquacer.c:212:7: note: remove the 'if' if its condition is always true else if (priv->mode & SPI_TX_OCTAL) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/spi/spi-synquacer.c:189:25: note: initialize the variable 'bus_width' to silence this warning So initialize bus_width to 1 and add a warning if none of the configured modes matches Signed-off-by: Ilias Apalodimas Acked-by: Jassi Brar --- drivers/spi/spi-synquacer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index 0cae3dfc778f..0f5d0a30c39d 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -186,7 +186,7 @@ static void synquacer_spi_config(struct udevice *dev, void *rx, const void *tx) struct udevice *bus = dev->parent; struct synquacer_spi_priv *priv = dev_get_priv(bus); struct dm_spi_slave_plat *slave_plat = dev_get_parent_plat(dev); - u32 val, div, bus_width; + u32 val, div, bus_width = 1; int rwflag; rwflag = (rx ? 1 : 0) | (tx ? 2 : 0); @@ -211,6 +211,8 @@ static void synquacer_spi_config(struct udevice *dev, void *rx, const void *tx) bus_width = 4; else if (priv->mode & SPI_TX_OCTAL) bus_width = 8; + else + log_warning("SPI mode not configured, setting to byte mode\n"); div = DIV_ROUND_UP(125000000, priv->speed);