]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
regulator: core: Remove redundant ternary operators
authorLiao Yuanhong <liaoyuanhong@vivo.com>
Thu, 28 Aug 2025 12:27:37 +0000 (20:27 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 28 Aug 2025 14:02:51 +0000 (16:02 +0200)
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
Message-ID: <20250828122737.43488-1-liaoyuanhong@vivo.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c

index 554d83c4af0c1c98edb43b60dbfacb8844d5e1eb..dd7b10e768c06c83d2a4fb5dfd0fce8d796c9185 100644 (file)
@@ -1586,8 +1586,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
        }
 
        if (rdev->constraints->active_discharge && ops->set_active_discharge) {
-               bool ad_state = (rdev->constraints->active_discharge ==
-                             REGULATOR_ACTIVE_DISCHARGE_ENABLE) ? true : false;
+               bool ad_state = rdev->constraints->active_discharge ==
+                             REGULATOR_ACTIVE_DISCHARGE_ENABLE;
 
                ret = ops->set_active_discharge(rdev, ad_state);
                if (ret < 0) {