From patchwork Thu Nov 19 10:50:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 7656411 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75797BF90C for ; Thu, 19 Nov 2015 10:54:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91B5A2054D for ; Thu, 19 Nov 2015 10:54:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B18972052A for ; Thu, 19 Nov 2015 10:54:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzMot-0004NY-Cp; Thu, 19 Nov 2015 10:52:03 +0000 Received: from mail-wm0-x235.google.com ([2a00:1450:400c:c09::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzMoq-0004Ec-H4 for linux-arm-kernel@lists.infradead.org; Thu, 19 Nov 2015 10:52:01 +0000 Received: by wmdw130 with SMTP id w130so234882002wmd.0 for ; Thu, 19 Nov 2015 02:51:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=auFr2GRlaoUzGlm4qrATy+4jgrrRfx6XbEEJFAyzC6M=; b=si+Psl8DD4Cl2BMa3Wgcp07eM+SRkQ9kqd8lTj8DLSE6bUCoaTZHmvAUTe7IUztMJa /gh5Sb3X2SRW5bMtCfbErmrmTILEGQFK0Q65PGtR7nDL7MR15bvc18X0RABd7edr/y0z zhKx5nTaVtyLdK2srrU+yGKRVy5F9LVsVKlzIrjsd/fvRDdELJVJTAq1C3MsbOxvdH72 BUCSUQp7ZID5sxrrs/atm8Lu2uDUyuzanIt09HGWmp7mxQzb7wRA99BsZElIPDYLma8M Xo7o/CGFLJA9JFUzgpFC2X5IctThAoWA9Fq463f3NHKT9UG3BUSCj/+BIh2gSw42PJYL /NrQ== X-Received: by 10.194.87.230 with SMTP id bb6mr8686400wjb.157.1447930298852; Thu, 19 Nov 2015 02:51:38 -0800 (PST) Received: from Red.local (ANice-651-1-376-123.w86-193.abo.wanadoo.fr. [86.193.8.123]) by smtp.googlemail.com with ESMTPSA id z1sm7267760wje.35.2015.11.19.02.51.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Nov 2015 02:51:38 -0800 (PST) From: LABBE Corentin To: alexandre.belloni@free-electrons.com, a.zummo@towertech.it, linux-arm-kernel@lists.infradead.org, maxime.ripard@free-electrons.com, wens@csie.org Subject: [PATCH 1/3] rtc: sunxi: fix signedness issues Date: Thu, 19 Nov 2015 11:50:08 +0100 Message-Id: <1447930210-27008-1-git-send-email-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.4.10 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151119_025200_778686_4300EC12 X-CRM114-Status: GOOD ( 13.14 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: LABBE Corentin , linux-kernel@vger.kernel.org, rtc-linux@googlegroups.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The variable year must be set as unsigned since it is used with sunxi_rtc_data_year{.min|.max} and as parameter of is_leap_year() which wait for unsigned int. Only tm_year is not unsigned, but it is long. This patch fix also the format of printing of min/max. (must use %u since they are unsigned) The parameter to of sunxi_rtc_setaie() must be set to uint since callers give always uint data. Signed-off-by: LABBE Corentin Acked-by: Chen-Yu Tsai --- drivers/rtc/rtc-sunxi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-sunxi.c b/drivers/rtc/rtc-sunxi.c index 52543ae..b4f35ac 100644 --- a/drivers/rtc/rtc-sunxi.c +++ b/drivers/rtc/rtc-sunxi.c @@ -175,7 +175,7 @@ static irqreturn_t sunxi_rtc_alarmirq(int irq, void *id) return IRQ_NONE; } -static void sunxi_rtc_setaie(int to, struct sunxi_rtc_dev *chip) +static void sunxi_rtc_setaie(unsigned int to, struct sunxi_rtc_dev *chip) { u32 alrm_val = 0; u32 alrm_irq_val = 0; @@ -343,7 +343,7 @@ static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm) struct sunxi_rtc_dev *chip = dev_get_drvdata(dev); u32 date = 0; u32 time = 0; - int year; + unsigned int year; /* * the input rtc_tm->tm_year is the offset relative to 1900. We use @@ -353,8 +353,8 @@ static int sunxi_rtc_settime(struct device *dev, struct rtc_time *rtc_tm) year = rtc_tm->tm_year + 1900; if (year < chip->data_year->min || year > chip->data_year->max) { - dev_err(dev, "rtc only supports year in range %d - %d\n", - chip->data_year->min, chip->data_year->max); + dev_err(dev, "rtc only supports year in range %u - %u\n", + chip->data_year->min, chip->data_year->max); return -EINVAL; }