Both the OP-TEE core and some OP-TEE drivers use an if/else expression to check a boolean which can instead be returned directly. Implement this change.
--- Rouven Czerwinski (3): optee: simplify OP-TEE context match hwrng: optee - simplify OP-TEE context match rtc: optee: simplify OP-TEE context match
drivers/char/hw_random/optee-rng.c | 5 +---- drivers/rtc/rtc-optee.c | 5 +---- drivers/tee/optee/device.c | 5 +---- 3 files changed, 3 insertions(+), 12 deletions(-) --- base-commit: 63804fed149a6750ffd28610c5c1c98cce6bd377 change-id: 20260126-optee-simplify-context-match-d5b3467bfacc
Best regards,
From: Rouven Czerwinski rouven.czerwinski@linaro.org
Simplify the TEE implementor ID match by returning the boolean expression directly instead of going through an if/else.
Signed-off-by: Rouven Czerwinski rouven.czerwinski@linaro.org --- drivers/tee/optee/device.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/tee/optee/device.c b/drivers/tee/optee/device.c index 950b4661d5df..4c85b04d6004 100644 --- a/drivers/tee/optee/device.c +++ b/drivers/tee/optee/device.c @@ -13,10 +13,7 @@
static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data) { - if (ver->impl_id == TEE_IMPL_ID_OPTEE) - return 1; - else - return 0; + return (ver->impl_id == TEE_IMPL_ID_OPTEE); }
static int get_devices(struct tee_context *ctx, u32 session,
From: Rouven Czerwinski rouven.czerwinski@linaro.org
Simplify the TEE implementor ID match by returning the boolean expression directly instead of going through an if/else.
Signed-off-by: Rouven Czerwinski rouven.czerwinski@linaro.org --- drivers/char/hw_random/optee-rng.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/char/hw_random/optee-rng.c b/drivers/char/hw_random/optee-rng.c index 96b5d546d136..1cb741a6d112 100644 --- a/drivers/char/hw_random/optee-rng.c +++ b/drivers/char/hw_random/optee-rng.c @@ -205,10 +205,7 @@ static int get_optee_rng_info(struct device *dev)
static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data) { - if (ver->impl_id == TEE_IMPL_ID_OPTEE) - return 1; - else - return 0; + return (ver->impl_id == TEE_IMPL_ID_OPTEE); }
static int optee_rng_probe(struct device *dev)
From: Rouven Czerwinski rouven.czerwinski@linaro.org
Simplify the TEE implementor ID match by returning the boolean expression directly instead of going through an if/else.
Signed-off-by: Rouven Czerwinski rouven.czerwinski@linaro.org --- drivers/rtc/rtc-optee.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/rtc/rtc-optee.c b/drivers/rtc/rtc-optee.c index 184c6d142801..2f18be3de684 100644 --- a/drivers/rtc/rtc-optee.c +++ b/drivers/rtc/rtc-optee.c @@ -541,10 +541,7 @@ static int optee_rtc_read_info(struct device *dev, struct rtc_device *rtc,
static int optee_ctx_match(struct tee_ioctl_version_data *ver, const void *data) { - if (ver->impl_id == TEE_IMPL_ID_OPTEE) - return 1; - else - return 0; + return (ver->impl_id == TEE_IMPL_ID_OPTEE); }
static int optee_rtc_probe(struct device *dev)
op-tee@lists.trustedfirmware.org