From patchwork Sun Feb 25 16:56:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Laight X-Patchwork-Id: 13570992 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51A4518045 for ; Sun, 25 Feb 2024 16:56:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.58.85.151 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708880182; cv=none; b=ajF5DeNLK9s1ytATBikWD6HQWsBSO7pZWVdwOuOnKrcXE97p2B7iKKmqbqpb3UU5Mx4gFkfP4yPpxFe6SYcEJ216RQWQyRNqJLjDsgr+Tycs+lsp99NblOEdmKYcrIT51ZmWeqyja6+033T3+RHr+UmCBs7qOT8KqHKc93xLKfM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708880182; c=relaxed/simple; bh=zOWFqzB7N0pb8vLD4U0rutFH4q0ufXT6YzwjVxhLXv0=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: MIME-Version:Content-Type; b=KG8gfghepICGN0Ijh2mR9VNg92YO9E/gLAaB8dmJv21um218VGrFQSILi8A10GrN4KdTnISeM/KPAFgFe2Cpw+zsMkLcEFdYOqwJ4OitE4fr2NqZEx4cEJ7E2YrAtyX96lmjRQ6tH2mUTG6YNn13cQZFlgwIlwBQDWAYmJm+ysI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM; spf=pass smtp.mailfrom=aculab.com; arc=none smtp.client-ip=185.58.85.151 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ACULAB.COM Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aculab.com Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-258-4eUIVhTQPOq-JwK6Hr19cA-1; Sun, 25 Feb 2024 16:56:17 +0000 X-MC-Unique: 4eUIVhTQPOq-JwK6Hr19cA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Sun, 25 Feb 2024 16:56:16 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Sun, 25 Feb 2024 16:56:16 +0000 From: David Laight To: "'linux-kernel@vger.kernel.org'" , "'Linus Torvalds'" , 'Netdev' , "'dri-devel@lists.freedesktop.org'" CC: 'Jens Axboe' , "'Matthew Wilcox (Oracle)'" , 'Christoph Hellwig' , "'linux-btrfs@vger.kernel.org'" , "'Andrew Morton'" , 'Andy Shevchenko' , "'David S . Miller'" , 'Dan Carpenter' , "'Jani Nikula'" Subject: [PATCH next v2 10/11] block: Use a boolean expression instead of max() on booleans Thread-Topic: [PATCH next v2 10/11] block: Use a boolean expression instead of max() on booleans Thread-Index: AdpoC3sh/004JKwJQQKikvnz7Zkpuw== Date: Sun, 25 Feb 2024 16:56:16 +0000 Message-ID: <9561641946f1404b931d97a576bfbb28@AcuMS.aculab.com> References: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> In-Reply-To: <0fff52305e584036a777f440b5f474da@AcuMS.aculab.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US blk_stack_limits() contains: t->zoned = max(t->zoned, b->zoned); These are bool, so can be replaced by bitwise or. However it generates: error: comparison of constant '0' with boolean expression is always true [-Werror=bool-compare] inside the signedness check that max() does unless a '+ 0' is added. It is a shame the compiler generates this warning for code that will be optimised away. Change so that the extra '+ 0' can be removed. Signed-off-by: David Laight --- block/blk-settings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Changes for v2: - Typographical and spelling corrections to the commit messages. Patches unchanged. diff --git a/block/blk-settings.c b/block/blk-settings.c index 06ea91e51b8b..9ca21fea039d 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -688,7 +688,7 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b, b->max_secure_erase_sectors); t->zone_write_granularity = max(t->zone_write_granularity, b->zone_write_granularity); - t->zoned = max(t->zoned, b->zoned); + t->zoned = t->zoned | b->zoned; return ret; } EXPORT_SYMBOL(blk_stack_limits);