Messages in this thread Patch in this message | | | From | Andy Shevchenko <> | Subject | [PATCH v1 06/14] extcon: Allow name to be assigned outside of the framework | Date | Wed, 22 Mar 2023 16:39:57 +0200 |
| |
The documentation states that name of the extcon can be assigned outside of the framework, however code does something different. Fix the code to be aligned with the documentation.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/extcon/extcon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index ac84f4aafc69..14e66e21597f 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -1269,10 +1269,10 @@ int extcon_dev_register(struct extcon_dev *edev) edev->dev.class = extcon_class; edev->dev.release = extcon_dev_release; - edev->name = dev_name(edev->dev.parent); - if (IS_ERR_OR_NULL(edev->name)) { - dev_err(&edev->dev, - "extcon device name is null\n"); + if (!edev->name) + edev->name = dev_name(edev->dev.parent); + if (!edev->name) { + dev_err(&edev->dev, "extcon device name is null\n"); return -EINVAL; } dev_set_name(&edev->dev, "extcon%lu", -- 2.40.0.1.gaa8946217a0b
| |