From nobody Sat Apr 11 13:37:34 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 F015EFA373D for ; Fri, 28 Oct 2022 01:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235872AbiJ1BtD (ORCPT ); Thu, 27 Oct 2022 21:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235808AbiJ1Bsp (ORCPT ); Thu, 27 Oct 2022 21:48:45 -0400 Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90F58AC2B8 for ; Thu, 27 Oct 2022 18:48:44 -0700 (PDT) Received: by mail-qk1-x735.google.com with SMTP id m6so2609112qkm.4 for ; Thu, 27 Oct 2022 18:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=B4DUoigKs4i4MiSm7mPBHdj9bSfZn7HJiVErqHP64bE=; b=UP9smFtqIJjIO979pi3gSZOEWo/rG0oI4HF9M0LEHAkvHp0V+9yCj+EFIWT+WIobvN RfXWB5vQJOGlcZIpP5JRkmeKnkUGDAPNU8TE9KKqlYfpywXW7A4opkitijzTa7Dg7Q6l fRRc7iK57T0KY6v/5JyGUtzB0dVtv54gf9vhTNn0BTQkbUo54qO3ozfQxN+Lqe7a0+me P5/7Q/JRXLtmh2jZ3G+pzxKK4D8uQ56ag8AB6iWUh+hWBZljw85ghQF4Hk+QyWmHrOLk +27V0GcsMkSKqYLgMfpF163SYYnLlGY+BNn/bgGUlSWHdWp510X8wk4rVUCqBj7lFfVw 1POQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B4DUoigKs4i4MiSm7mPBHdj9bSfZn7HJiVErqHP64bE=; b=4Uhoz6VK+QQ+qUV6HKimQY5bBvOWYP3gEz+jV0gznPm3EGEVCEfg+EI6b2mBTqf3Rn oNFU7Tn4JxTTYpLE1EMAJvfIvsW/SOW3rJezMzDZ1VP6OoKfGCt19qQmWiu1GDPSjvJW VXLpRJp5m4kcgHzOwYPj3oSZmYUXCDy9CBFyFFW7mgk4wzrmouP6qu/HKSrCPadeK99D lln80lMGuBbtEk8Qo5Jxa5gO2rp7CuKqhTSMJaNtDaYIpwxx+VFBnxbqreAX6qHpWvRL 7is7No7sUhhKH3WldUZrbazeNzb9R+h9QDeWJ555ERdp7QyFdBnXgtFH7ablfAkFpU8c 55MQ== X-Gm-Message-State: ACrzQf0Kw2nqktin+WX9p4sv20zZraTJYDqtjdmGxWByo1e4OLqpj4iY qXodrFYDEI0gV4prEGtRe48Z4OIVvhw= X-Google-Smtp-Source: AMsMyM62bQm2oaXxoSO0wsgEfbitbvsBYBDq7GQ+ii63cmFBLU9QqGhopJZuWn3ehRSFDIZuxGUAdA== X-Received: by 2002:a05:620a:2629:b0:6ee:b2cf:aeb5 with SMTP id z41-20020a05620a262900b006eeb2cfaeb5mr36464857qko.62.1666921723522; Thu, 27 Oct 2022 18:48:43 -0700 (PDT) Received: from localhost ([2601:589:4102:4c7c:d8d0:78d7:ad97:2651]) by smtp.gmail.com with ESMTPSA id l13-20020a05620a28cd00b006f8665f483fsm2120991qkp.85.2022.10.27.18.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Oct 2022 18:48:43 -0700 (PDT) From: Yury Norov To: linux-kernel@vger.kernel.org, Andy Shevchenko , Rasmus Villemoes , Yury Norov Subject: [PATCH 5/6] bitmap: fix opencoded bitmap_allocate_region() Date: Thu, 27 Oct 2022 18:48:33 -0700 Message-Id: <20221028014834.572819-6-yury.norov@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221028014834.572819-1-yury.norov@gmail.com> References: <20221028014834.572819-1-yury.norov@gmail.com> 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" bitmap_find_region() opencodes bitmap_allocate_region(). Fix it. Signed-off-by: Yury Norov --- lib/bitmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/bitmap.c b/lib/bitmap.c index 389446b6f248..2a85fe16f3fa 100644 --- a/lib/bitmap.c +++ b/lib/bitmap.c @@ -1315,10 +1315,8 @@ int bitmap_find_free_region(unsigned long *bitmap, u= nsigned int bits, int order) unsigned int pos, end; /* scans bitmap by regions of size order */ =20 for (pos =3D 0 ; (end =3D pos + (1U << order)) <=3D bits; pos =3D end) { - if (!bitmap_empty_from(bitmap, pos, pos + BIT(order))) - continue; - bitmap_set(bitmap, pos, pos + BIT(order)); - return pos; + if (!bitmap_allocate_region(bitmap, pos, order)) + return pos; } return -ENOMEM; } --=20 2.34.1