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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69617C433F5 for ; Fri, 20 May 2022 08:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346955AbiETIZG (ORCPT ); Fri, 20 May 2022 04:25:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346962AbiETIZF (ORCPT ); Fri, 20 May 2022 04:25:05 -0400 Received: from relay12.mail.gandi.net (relay12.mail.gandi.net [IPv6:2001:4b98:dc4:8::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2BB114042C for ; Fri, 20 May 2022 01:25:02 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A65D620000A; Fri, 20 May 2022 08:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1653035101; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ID1+nmNLImnrgoFrnAXiyDCe2YN8dYKzqeCbV3qacjE=; b=ZGFEcVr8wuHoQ7TgU2f7fsICInFmyogn0QBaAcdp3+fGa+PcomPv5tW19dMSx1hsRWVaDh HMahYGjIzAhDwzdNk9e5LLCtXdbp6Et2f8KDMuk267qEGEZlFAkPxB1JmOgQixsoxr/XfG DbrnGy/Y+1MmE3+J/3hWxYSGALqDlEhI5gZCSVkr2eEyOKcgztIOx+Kb7suJX+fOBN4RpV 6/KrXynQ2VE5GyF21nXhkADSFQqrVOR8dYthyfI4VeHUxU0pnoqBC4JaP0qhN9HIXzJqRi 7ZlYHVXjMUKm81A0IGD36POaLJxtmMxdpEEOSq5AkVCumYoYlPrtUJ0X1MRcTA== From: Miquel Raynal To: Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org Cc: Miquel Raynal , Dan Carpenter Subject: [PATCH] rtc: rzn1: Fix a variable type Date: Fri, 20 May 2022 10:25:00 +0200 Message-Id: <20220520082500.489248-1-miquel.raynal@bootlin.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-rtc@vger.kernel.org The calculation in ->set_offset() handles both negative and positive offsets. The 'steps' variable will be checked to be in a specific [-x; +x] range, which means it must be a signed integer rather than unsigned. This also fixes the following smatch warning: warn: 'steps' 'true' implies 'steps > 0' is 'true' Fixes: be4a11cf98af ("rtc: rzn1: Add oscillator offset support") Reported-by: Dan Carpenter Signed-off-by: Miquel Raynal --- drivers/rtc/rtc-rzn1.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/rtc/rtc-rzn1.c b/drivers/rtc/rtc-rzn1.c index bdd4ebd5c887..66405b43ae7e 100644 --- a/drivers/rtc/rtc-rzn1.c +++ b/drivers/rtc/rtc-rzn1.c @@ -270,8 +270,7 @@ static int rzn1_rtc_read_offset(struct device *dev, long *offset) static int rzn1_rtc_set_offset(struct device *dev, long offset) { struct rzn1_rtc *rtc = dev_get_drvdata(dev); - unsigned int steps; - int stepsh, stepsl; + int stepsh, stepsl, steps; u32 subu = 0, ctl2; int ret; -- 2.34.1