Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1568730imu; Sun, 18 Nov 2018 04:40:08 -0800 (PST) X-Google-Smtp-Source: AJdET5cKmqbgCqAo6ue7mJj/8cG34eIiN3+mepyoRquSJuUCJQqWrCMfRoPM+6XKPArFGWkZsIq3 X-Received: by 2002:a63:1321:: with SMTP id i33mr16759560pgl.380.1542544808491; Sun, 18 Nov 2018 04:40:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542544808; cv=none; d=google.com; s=arc-20160816; b=Jfpl+JKTMeqm+QqXZUtCMUZhAefHI27qIJxewyLe+dR1Qnk7NQZKSumSOdDMeeHBGm H+FLm6eL0YP8WUlZT4rEyv04xC5IknCZNVxZNtm8Yvp80CV7/9OqxHXcblc+AXf8VHVi 73Td33NdCRb8HUqkW6CheXijbVUem4lw2LcE76pfqSDqb+9kSKqNhWdz0vllbq2fvZOu bouX4y1S0TLXZYAG7tIxknq8TJ47dFV1zDnoB8RGxBXhGG3BJMZt+vvBwSeuw4c8f6tR tUbUT4JvaiS3MzKV/47zA32ZKlb5xcO+2hqh7bKmK/XnyssUVW7DF/6e6z2NJfJRjTo9 vJiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=5EsVpmGSwLEXqO5Yw/ar3HW8DAOIlhRG8rZqoBKvaPI=; b=X1ClDY3LWPCSC2BAJPqz+uB1X1bJtBJ6mY1O9u4A4HjgAJpnZkOJN3S4+CpEagTX2f KjRk3DTd9Ya6ulQAGayow1fwvYWay+0oxjNZX4Zg1QiZSMk46KXZF3CNCbJJU+D7OzqC F348HVJIZo22AeUufPsbPzvqxlY53Q8HlQONsK13Nik4eaBy/1jTga1MFJpfPZcyXPC1 tdz+ymHbt7BwQGPww/Ut+WWvWeX1uGxgHKyE0t+lB115NH6Hp14utJUrNakucl4yhxRS VNPA6GD7MMuOC9iRQ/NhR3NtN9caRNdY27AsjfNvcvyEmeIPoUjD3qkkq59oI2sdYF/Q rLiQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 i2si36128271pgl.153.2018.11.18.04.39.53; Sun, 18 Nov 2018 04:40:08 -0800 (PST) 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; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727195AbeKRWz4 (ORCPT + 99 others); Sun, 18 Nov 2018 17:55:56 -0500 Received: from 212.199.177.27.static.012.net.il ([212.199.177.27]:55339 "EHLO herzl.nuvoton.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726269AbeKRWzz (ORCPT ); Sun, 18 Nov 2018 17:55:55 -0500 Received: from taln60.nuvoton.co.il (ntil-fw [212.199.177.25]) by herzl.nuvoton.co.il (8.13.8/8.13.8) with ESMTP id wAIC58Dg005945; Sun, 18 Nov 2018 14:05:08 +0200 Received: by taln60.nuvoton.co.il (Postfix, from userid 10070) id D4270630C7; Sun, 18 Nov 2018 14:35:06 +0200 (IST) From: Tomer Maimon To: broonie@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, yuenn@google.com, venture@google.com, brendanhiggins@google.com, avifishman70@gmail.com, joel@jms.id.au Cc: linux-spi@vger.kernel.org, openbmc@lists.ozlabs.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Tomer Maimon Subject: [PATCH v1 1/1] spi: npcm: fix uninitialized 'val' warning in receive function Date: Sun, 18 Nov 2018 14:35:04 +0200 Message-Id: <20181118123504.83082-2-tmaimon77@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20181118123504.83082-1-tmaimon77@gmail.com> References: <20181118123504.83082-1-tmaimon77@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix uninitialized 'val' warning receive function, send function has been modify to be aligned with the receive function. Signed-off-by: Tomer Maimon --- drivers/spi/spi-npcm-pspi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/spi/spi-npcm-pspi.c b/drivers/spi/spi-npcm-pspi.c index 6dae91091143..f75df49ab84e 100644 --- a/drivers/spi/spi-npcm-pspi.c +++ b/drivers/spi/spi-npcm-pspi.c @@ -199,11 +199,11 @@ static void npcm_pspi_send(struct npcm_pspi *priv) wsize = min(bytes_per_word(priv->bits_per_word), priv->tx_bytes); priv->tx_bytes -= wsize; - if (priv->tx_buf) { - if (wsize == 1) - iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base); + if (priv->tx_buf && wsize) { if (wsize == 2) iowrite16(*priv->tx_buf, NPCM_PSPI_DATA + priv->base); + else + iowrite8(*priv->tx_buf, NPCM_PSPI_DATA + priv->base); priv->tx_buf += wsize; } @@ -217,11 +217,11 @@ static void npcm_pspi_recv(struct npcm_pspi *priv) rsize = min(bytes_per_word(priv->bits_per_word), priv->rx_bytes); priv->rx_bytes -= rsize; - if (priv->rx_buf) { - if (rsize == 1) - val = ioread8(priv->base + NPCM_PSPI_DATA); + if (priv->rx_buf && rsize) { if (rsize == 2) val = ioread16(priv->base + NPCM_PSPI_DATA); + else + val = ioread8(priv->base + NPCM_PSPI_DATA); *priv->rx_buf = val; priv->rx_buf += rsize; -- 2.14.1