[PATCH v0 09/42] iio: proximity: cros_ec: Check notifier registration return value

From: Borislav Petkov
Date: Mon Nov 08 2021 - 05:13:17 EST


From: Borislav Petkov <bp@xxxxxxx>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Cc: linux-iio@xxxxxxxxxxxxxxx
---
drivers/iio/proximity/cros_ec_mkbp_proximity.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
index 8213b0081713..e9536de8dd8a 100644
--- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c
+++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c
@@ -234,7 +234,8 @@ static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev)
return ret;

data->notifier.notifier_call = cros_ec_mkbp_proximity_notify;
- blocking_notifier_chain_register(&ec->event_notifier, &data->notifier);
+ if (blocking_notifier_chain_register(&ec->event_notifier, &data->notifier))
+ pr_warn("cros-ec proximity notifier already registered\n");

return 0;
}
--
2.29.2