diff options
author | Bumwoo Lee <bw365.lee@samsung.com> | 2023-03-02 18:01:40 +0900 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2023-05-29 23:31:24 +0900 |
commit | 7f4c9bc29ba72c5e3d0f9eaa91cabac9cd3342c9 (patch) | |
tree | 03020f1c9fb20e4322a045d37b602a5010abe10f /drivers/extcon/extcon.c | |
parent | c95fb88fb6e4bd92720a183014d9160e627e4c4b (diff) |
extcon: Remove redundant null checking for class
create_extcon_class() is already Null checking.
Signed-off-by: Bumwoo Lee <bw365.lee@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon.c')
-rw-r--r-- | drivers/extcon/extcon.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index d43ba8e7260d..2fa033711a55 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1012,12 +1012,13 @@ ATTRIBUTE_GROUPS(extcon); static int create_extcon_class(void) { - if (!extcon_class) { - extcon_class = class_create("extcon"); - if (IS_ERR(extcon_class)) - return PTR_ERR(extcon_class); - extcon_class->dev_groups = extcon_groups; - } + if (extcon_class) + return 0; + + extcon_class = class_create("extcon"); + if (IS_ERR(extcon_class)) + return PTR_ERR(extcon_class); + extcon_class->dev_groups = extcon_groups; return 0; } @@ -1088,11 +1089,9 @@ int extcon_dev_register(struct extcon_dev *edev) int ret, index = 0; static atomic_t edev_no = ATOMIC_INIT(-1); - if (!extcon_class) { - ret = create_extcon_class(); - if (ret < 0) - return ret; - } + ret = create_extcon_class(); + if (ret < 0) + return ret; if (!edev || !edev->supported_cable) return -EINVAL; |