From nobody Sun Sep 7 12:18:21 2025 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 A6198C38145 for ; Fri, 2 Sep 2022 12:52:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237862AbiIBMwi (ORCPT ); Fri, 2 Sep 2022 08:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237790AbiIBMvn (ORCPT ); Fri, 2 Sep 2022 08:51:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD245FFA; Fri, 2 Sep 2022 05:37:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 541A8B82AC1; Fri, 2 Sep 2022 12:30:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C9DC43148; Fri, 2 Sep 2022 12:30:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1662121808; bh=ZJbxRJ0vFFPJ1uzFC8Exro17QL7g+4rklVQcPUsnADc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sGX6QNimB9EWpHzKf5CsUx9aTG8LWqUzjPyfIm+VT28l4O0eCQVKOmgZWY1cwiDaE 7K8gsLEZYM/g9Hxql0oyguFo3msjumGXt9swBwJh/fuJq1bBdq04jdf59JneXFwO2D zTpjcdKaehbp8P4ldWmvDqzmx7+tSiC0+OZ9Q4s0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Thomas Gleixner , Sasha Levin Subject: [PATCH 5.4 72/77] lib/vdso: Let do_coarse() return 0 to simplify the callsite Date: Fri, 2 Sep 2022 14:19:21 +0200 Message-Id: <20220902121406.079699178@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220902121403.569927325@linuxfoundation.org> References: <20220902121403.569927325@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 8463cf80529d0fd80b84cd5ab8b9b952b01c7eb9 ] do_coarse() is similar to do_hres() except that it never fails. Change its type to int instead of void and let it always return success (0) to simplify the call site. Signed-off-by: Christophe Leroy Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/21e8afa38c02ca8672c2690307383507fe63b454.15= 77111367.git.christophe.leroy@c-s.fr Signed-off-by: Sasha Levin --- lib/vdso/gettimeofday.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 45f57fd2db649..c549e72758aa0 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -68,7 +68,7 @@ static int do_hres(const struct vdso_data *vd, clockid_t = clk, return 0; } =20 -static void do_coarse(const struct vdso_data *vd, clockid_t clk, +static int do_coarse(const struct vdso_data *vd, clockid_t clk, struct __kernel_timespec *ts) { const struct vdso_timestamp *vdso_ts =3D &vd->basetime[clk]; @@ -79,6 +79,8 @@ static void do_coarse(const struct vdso_data *vd, clockid= _t clk, ts->tv_sec =3D vdso_ts->sec; ts->tv_nsec =3D vdso_ts->nsec; } while (unlikely(vdso_read_retry(vd, seq))); + + return 0; } =20 static __maybe_unused int @@ -96,14 +98,13 @@ __cvdso_clock_gettime_common(clockid_t clock, struct __= kernel_timespec *ts) * clocks are handled in the VDSO directly. */ msk =3D 1U << clock; - if (likely(msk & VDSO_HRES)) { + if (likely(msk & VDSO_HRES)) return do_hres(&vd[CS_HRES_COARSE], clock, ts); - } else if (msk & VDSO_COARSE) { - do_coarse(&vd[CS_HRES_COARSE], clock, ts); - return 0; - } else if (msk & VDSO_RAW) { + else if (msk & VDSO_COARSE) + return do_coarse(&vd[CS_HRES_COARSE], clock, ts); + else if (msk & VDSO_RAW) return do_hres(&vd[CS_RAW], clock, ts); - } + return -1; } =20 --=20 2.35.1