Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp1812823ybj; Sun, 22 Sep 2019 12:30:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz/u1m/GRCbwZNpPa5S7cL4GNwuEkFZwXGM7GEfvbjdC2Rf8W/DUePGgLbciMqsPuKg0rJ X-Received: by 2002:aa7:d48f:: with SMTP id b15mr33287269edr.159.1569180644191; Sun, 22 Sep 2019 12:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569180644; cv=none; d=google.com; s=arc-20160816; b=buBa93U9xnEAu/MDcHEsv7HYpTZT0S9G06lmrcCSnjEERNFD8nHuUqv+0kEzT1ApKC w7gsOKH4fdY3eNDkN66/gutoUD25MyX7aSiQPgdEs0C/mg6SkDiyBhCQBoJFSF7H7V/Y t1iQofJrF61epfY4AFUyqDOgXLVXrtPEi/3ThCOo0m5BwmCBdfpTxN0JVTKU6Y03o8Gu XJb0Btnwi6hVQ2gOQ6XU9b/0ji/TcLSM7I15SRzsrxIjWLFuHNLWpeYG1LnA/ucih2ZF GyFk4CBGsCtApdY7/f7LoKG1CZlAX/At4qbkHodqSpofs/SVkvxSeOXt9xKhRxmsfk2D cikw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Y5yY7OJCxWgB5HcfzAhVPpgHG+9k4gTzUpd5CH1fgNw=; b=E+uDGxcV6UICzqMT7IBTHCGdVw9cf6+iRzzt0sRARpcyK17qoJTlMC5MdlOrwASV9V EL2gfM1ZyOU9GpC+SYQayKahwq7FylxusJnEjY6Tc6HxzzqgTpRxUgEHDaCXjTLkiiwf yKq6LUuknPVwLBLjKOH8wCyl7c21YQBF0ofe2AeykimlxsdyjF7Ls9ysSd7E0Lt0clhT qMZOCy1ohmMmFGCdKBUTUfAY3M4JNisLVR94Vtgw8lLWM3bEl36wYhRcNA3dBATcmSeJ hR+hvqyUylQ3IYeoyB+YIa2EOYK2LfLeuspt058zoHdZHLfCglMv44ZTRFLgUyM9dYRX EyOg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e46si5235565eda.401.2019.09.22.12.30.20; Sun, 22 Sep 2019 12:30:44 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387627AbfIVQNP (ORCPT + 99 others); Sun, 22 Sep 2019 12:13:15 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:46422 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387471AbfIVQNP (ORCPT ); Sun, 22 Sep 2019 12:13:15 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 63E0381096; Sun, 22 Sep 2019 18:12:59 +0200 (CEST) Date: Sun, 22 Sep 2019 18:13:06 +0200 From: Pavel Machek To: Nick Crews Cc: bleung@chromium.org, Alexandre Belloni , Alessandro Zummo , enric.balletbo@collabora.com, linux-kernel@vger.kernel.org, dlaurie@chromium.org Subject: Re: [PATCH v2 1/2] rtc: wilco-ec: Remove yday and wday calculations Message-ID: <20190922161306.GA1999@bug> References: <20190916181215.501-1-ncrews@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190916181215.501-1-ncrews@chromium.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2019-09-16 12:12:15, Nick Crews wrote: > The tm_yday and tm_wday fields are not used by userspace, > so since they aren't needed within the driver, don't > bother calculating them. This is especially needed since > the rtc_year_days() call was crashing if the HW returned > an invalid time. > > Signed-off-by: Nick Crews > --- > drivers/rtc/rtc-wilco-ec.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c > index 8ad4c4e6d557..e84faa268caf 100644 > --- a/drivers/rtc/rtc-wilco-ec.c > +++ b/drivers/rtc/rtc-wilco-ec.c > @@ -110,10 +110,6 @@ static int wilco_ec_rtc_read(struct device *dev, struct rtc_time *tm) > tm->tm_mday = rtc.day; > tm->tm_mon = rtc.month - 1; > tm->tm_year = rtc.year + (rtc.century * 100) - 1900; > - tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); > - > - /* Don't compute day of week, we don't need it. */ > - tm->tm_wday = -1; > > return 0; Are you sure? It would be bad to pass unititialized memory to userspace... If userspace does not need those fields, why are they there? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html