From nobody Sun Jun 28 00:09:00 2026 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 82EFFC433F5 for ; Thu, 17 Feb 2022 08:25:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237476AbiBQIZO convert rfc822-to-8bit (ORCPT ); Thu, 17 Feb 2022 03:25:14 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232546AbiBQIZM (ORCPT ); Thu, 17 Feb 2022 03:25:12 -0500 X-Greylist: delayed 560 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 17 Feb 2022 00:24:56 PST Received: from mx1.emlix.com (mx1.emlix.com [136.243.223.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1594297237 for ; Thu, 17 Feb 2022 00:24:56 -0800 (PST) Received: from mailer.emlix.com (p5098be52.dip0.t-ipconnect.de [80.152.190.82]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.emlix.com (Postfix) with ESMTPS id 9372D60196; Thu, 17 Feb 2022 09:15:34 +0100 (CET) From: Rolf Eike Beer To: Peter Zijlstra , Boqun Feng , Ingo Molnar , Will Deacon , Waiman Long Cc: linux-kernel@vger.kernel.org Subject: [PATCH] locking/rwsem: mark down_(read|write)_trylock() as __must_check Date: Thu, 17 Feb 2022 09:15:33 +0100 Message-ID: <15670760.jIsrciUiTQ@mobilepool36.emlix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When you don't look at the return code you can't know if you actually got the lock. Signed-off-by: Rolf Eike Beer --- include/linux/rwsem.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index f9348769e558..f62fa3ec95de 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h @@ -178,7 +178,7 @@ extern int __must_check down_read_killable(struct rw_se= maphore *sem); /* * trylock for reading -- returns 1 if successful, 0 if contention */ -extern int down_read_trylock(struct rw_semaphore *sem); +extern int __must_check down_read_trylock(struct rw_semaphore *sem); =20 /* * lock for writing @@ -189,7 +189,7 @@ extern int __must_check down_write_killable(struct rw_s= emaphore *sem); /* * trylock for writing -- returns 1 if successful, 0 if contention */ -extern int down_write_trylock(struct rw_semaphore *sem); +extern int __must_check down_write_trylock(struct rw_semaphore *sem); =20 /* * release a read lock --=20 2.35.1 --=20 Rolf Eike Beer, emlix GmbH, https://www.emlix.com Fon +49 551 30664-0, Fax +49 551 30664-11 Gothaer Platz 3, 37083 G=C3=B6ttingen, Germany Sitz der Gesellschaft: G=C3=B6ttingen, Amtsgericht G=C3=B6ttingen HR B 3160 Gesch=C3=A4ftsf=C3=BChrung: Heike Jordan, Dr. Uwe Kracke =E2=80=93 Ust-IdNr= .: DE 205 198 055 emlix - smart embedded open source