From patchwork Thu May 9 04:43:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 163658 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:142:0:0:0:0 with SMTP id j2csp472800ilr; Wed, 8 May 2019 21:43:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvSeIlgagQSJbTKXQsnatroLnUeSJ/l+byFH8ZE3iMQzKW6aMeUn0AdJh8FqOx/DmJoSZU X-Received: by 2002:a62:489d:: with SMTP id q29mr2264872pfi.45.1557377036546; Wed, 08 May 2019 21:43:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557377036; cv=none; d=google.com; s=arc-20160816; b=fY2vMEiK3i7y9TxzpNklmCrusTDwfp/lwqljEtny0/VE45Hpvhh+TrlXut3BHk1RHP H58hOQ6rFBdgveNn3DleoHy/+yxbGxIFVvuuLy+onxmNOgJXDzX0h4YNVsKZUY8WS4+t qcj7OIyE2897ZxUK6O+fXMSFlr/+BKZxBO9iCbvQd+DxDngyoiNoLG7Xzlh8t4KMBLK/ k2vJEHr1hxDF7GkvXq5F+p0Ug4HQfhY3VNKhuoPCvjg2LrmmzRBgReYMMgrC1YwuWkH1 aiAL4T4DMA6IcEYmcIlV9iWfPAIOPqkfpE0jt1lzjwZ65ogmEyTsvauR9HYm0KQQKoDd Npbw== 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=scFbWph7JHrKM6HxwUqzW/4Hy+E4AbiQZE3dZlFlEXQ=; b=Ec7YNP7SZVimDVuCaH2yRzrcCyVkd7h+PIyT65diQpflvM5Hsz1RAi9ujwpQ79prPf OZPHznDaiHRjdPjGMacUNfi33OWZdZ5qhemcqZV9tYNJNxSFpuj7ozosvbdw1mKlW3go S35XMwITzBckl1eUm3VB9WUvz30wuriGf/1awOOpiV5+EUbtA2idtGq+QhaCIHcFz1d0 TH4cuTK8Kr0j/K6I5gcRCKjXuLyBCnVj+8C9DLViG8M2cGckaLhhdu7CxjHvx4Jw3kPg A7HZFfk1YPjGQGPy0n/SCgcOdjHuTP0qY2vwpNgwpzuO60NsxGABqEGXZ6vQa9p7pxtB nHWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="KzejU6z/"; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c7si1554498pgd.512.2019.05.08.21.43.56; Wed, 08 May 2019 21:43:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-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=@linaro.org header.s=google header.b="KzejU6z/"; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726084AbfEIEnz (ORCPT + 2 others); Thu, 9 May 2019 00:43:55 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:36710 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725869AbfEIEnz (ORCPT ); Thu, 9 May 2019 00:43:55 -0400 Received: by mail-pg1-f193.google.com with SMTP id a3so536414pgb.3 for ; Wed, 08 May 2019 21:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=scFbWph7JHrKM6HxwUqzW/4Hy+E4AbiQZE3dZlFlEXQ=; b=KzejU6z/bMnWbc4nTdChjaRy5hh/WkrH8R6FLw32mOfxhbSvUqWnkCHjxUVy7RbBrx hUZwVYLtDDDoGsHz3299ofeiq5Ye9ZhdH3f0s14WawZJNoFWVGvXHyTG6TZqEG15Dnhr HFOzYnEIFPqIghh+tpcz8SXSm/gIL1vGazQCH9DxNc2Egq3TQLwgR0MGq5IJJHHt42Xb FL/DUn781vh/zbOVkZm7EQnitpPO3liEZcqsB6ok8pMZQl46ktUrA/m3820B5gFTVczC G2omrG+8ljOkvM/JjVzBTxJ8mdJ2E0AJZHEcvYohaIWZxFerjgyS7ozOwjOYFEAPrtGx qjSQ== 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=scFbWph7JHrKM6HxwUqzW/4Hy+E4AbiQZE3dZlFlEXQ=; b=GZmcow6E3LemXCGXu23IbkP1WTO4JrnDkHk1APuGQfhnOKVzZReUi45thl4YtYyw5J jrDhl3vUsUBhZAaejY0VrskJMEPIHtgH8uuGlGsPow0R67CUCsRh8PjPWrWi4lSdsxPh 8LjjYeFwSaPdXOc8Jqlt8x3cMXgagkY/vBNORl1F+J7kqH2okO6jW0QuinPmjRiD9ZzF CbW8gP8Y2MMBHvQArNnBBiRFYRLUgGtcQP+EbGUJMfHwnnR8jM+7SAuwblyIFWMwZv+w UFJz2vSCmZlFo3qCjkQS49j5l/4i1fQhs1hiZseyzPiOl3sbBDbHQ/eODZZGprs98FSP 9Sxg== X-Gm-Message-State: APjAAAWumCGif+cX0Ngut69MXYqovmoKghBEfh/rVw8GiVEUyTaXwMf8 RrZGpHI1myjUDELgV3zd8PVXlQ== X-Received: by 2002:a63:d345:: with SMTP id u5mr2699553pgi.83.1557377034409; Wed, 08 May 2019 21:43:54 -0700 (PDT) Received: from localhost ([122.172.118.99]) by smtp.gmail.com with ESMTPSA id c137sm1254639pfb.154.2019.05.08.21.43.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 21:43:52 -0700 (PDT) From: Viresh Kumar To: Wolfram Sang Cc: Viresh Kumar , Vincent Guittot , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] i2c: sh_mobile: Fix compilation warning Date: Thu, 9 May 2019 10:13:46 +0530 Message-Id: X-Mailer: git-send-email 2.21.0.rc0.269.g1a574e7a288b MIME-Version: 1.0 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This currently generates a warning: drivers/i2c/busses/i2c-sh_mobile.c: In function 'sh_mobile_i2c_isr': drivers/i2c/busses/i2c-sh_mobile.c:399:26: warning: 'data' may be used uninitialized in this function [-Wmaybe-uninitialized] Though the code looks okay and shouldn't ever use the variable uninitialized. Fix the warning by moving the code around and getting rid of 'data'. Compile tested only. Signed-off-by: Viresh Kumar --- drivers/i2c/busses/i2c-sh_mobile.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) -- 2.21.0.rc0.269.g1a574e7a288b Tested-by: Wolfram Sang diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c index 8777af4c695e..945eb8504fb7 100644 --- a/drivers/i2c/busses/i2c-sh_mobile.c +++ b/drivers/i2c/busses/i2c-sh_mobile.c @@ -369,7 +369,6 @@ static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd) static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd) { - unsigned char data; int real_pos; /* switch from TX (address) to RX (data) adds two interrupts */ @@ -390,13 +389,11 @@ static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd) if (real_pos < 0) i2c_op(pd, OP_RX_STOP); else - data = i2c_op(pd, OP_RX_STOP_DATA); + pd->msg->buf[real_pos] = i2c_op(pd, OP_RX_STOP_DATA); } else if (real_pos >= 0) { - data = i2c_op(pd, OP_RX); + pd->msg->buf[real_pos] = i2c_op(pd, OP_RX); } - if (real_pos >= 0) - pd->msg->buf[real_pos] = data; done: pd->pos++; return pd->pos == (pd->msg->len + 2);