RE: [PATCH 3/4] extcon: added extcon_alloc_muex to simplify extcon register function

From: MyungJoo Ham
Date: Sun Feb 19 2023 - 23:37:27 EST


>--------- Original Message ---------
>Sender : 이범우 <bw365.lee@xxxxxxxxxxx>Product S/W Lab(VD)/삼성전자
>Date : 2023-02-17 17:48 (GMT+9)
>Title : [PATCH 3/4] extcon: added extcon_alloc_muex to simplify extcon register function
> 
>The mutual exclusive part is functionalized from extcon_dev_register.
>
>Signed-off-by: Bumwoo Lee <bw365.lee@xxxxxxxxxxx>
>---
> drivers/extcon/extcon.c | 105 ++++++++++++++++++++++------------------
> 1 file changed, 57 insertions(+), 48 deletions(-)
>
>diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
>index 28058a1d2745..93cab4fe178e 100644
>--- a/drivers/extcon/extcon.c
>+++ b/drivers/extcon/extcon.c
>@@ -1125,6 +1125,60 @@ static int extcon_alloc_cables(struct extcon_dev *edev)
>         return 0;
> }
> 
...
>-                if (!edev->attrs_muex) {
>-                        ret = -ENOMEM;
>-                        goto err_muex;
>-                }
...
>+        if (extcon_alloc_muex(edev))
>+                goto err_alloc_muex;

It's not good.
You may return an uninitialized value or 0 when your new function has an error.

Cheers,
MyungJoo