mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
hvc_sysfs: delete kernel object
delete kernel object if driver initialization gets failed Bug 4080433 Change-Id: Iabe0cabf32a067224f6e17a5e54a1c7d90161c16 Signed-off-by: Manish Bhardwaj <mbhardwaj@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921795 Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com> Reviewed-by: Sandeep Trasi <strasi@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
16a076bf64
commit
61f67509a8
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
* Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
@@ -133,12 +133,16 @@ static int __init hvc_sysfs_register(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (hyp_read_hyp_info(&ipa) != 0)
|
||||
return -EINVAL;
|
||||
if (hyp_read_hyp_info(&ipa) != 0) {
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
info = (__force struct hyp_info_page *)ioremap(ipa, sizeof(*info));
|
||||
if (info == NULL)
|
||||
return -EFAULT;
|
||||
if (info == NULL) {
|
||||
ret = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
buffs = info->trace_buffs;
|
||||
count = ARRAY_SIZE(info->trace_buffs);
|
||||
@@ -147,7 +151,8 @@ static int __init hvc_sysfs_register(void)
|
||||
if (MAX_NAME_SIZE < (ARRAY_SIZE(buffs[i].name) + 4U)) {
|
||||
TEGRA_HV_INFO("hyp_shared_memory_attrs.name size is small\n");
|
||||
iounmap((void __iomem *)info);
|
||||
return -EFAULT;
|
||||
ret = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
@@ -166,7 +171,8 @@ static int __init hvc_sysfs_register(void)
|
||||
} else {
|
||||
TEGRA_HV_INFO("snprintf failure - %s\n", buffs[i].name);
|
||||
iounmap((void __iomem *)info);
|
||||
return -EFAULT;
|
||||
ret = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = hvc_create_sysfs(kobj, &hyp_shared_memory_attrs[i]);
|
||||
@@ -192,7 +198,8 @@ static int __init hvc_sysfs_register(void)
|
||||
} else {
|
||||
TEGRA_HV_INFO("snprintf failure - pct\n");
|
||||
iounmap((void __iomem *)info);
|
||||
return -EFAULT;
|
||||
ret = -EFAULT;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = hvc_create_sysfs(kobj, &hyp_shared_memory_attrs[i]);
|
||||
@@ -204,6 +211,10 @@ static int __init hvc_sysfs_register(void)
|
||||
iounmap((void __iomem *)info);
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
kobject_del(kobj);
|
||||
return ret;
|
||||
}
|
||||
|
||||
late_initcall(hvc_sysfs_register);
|
||||
|
||||
Reference in New Issue
Block a user