[PATCH 3/7] ARM: omap: use cdev_open_by_name()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cdev_by_name() returns a cdev without increasing its reference count. In
order to maintain a proper reference counting use cdev_open_by_name()
instead and make sure it's closed afterwards when no longer needed.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/mach-omap/omap_generic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap/omap_generic.c b/arch/arm/mach-omap/omap_generic.c
index 99e14fb540..112c806216 100644
--- a/arch/arm/mach-omap/omap_generic.c
+++ b/arch/arm/mach-omap/omap_generic.c
@@ -157,13 +157,16 @@ static int omap_env_init(void)
 
 	device_detect_by_name(diskdev);
 	partname = basprintf("%s.0", diskdev);
-	cdev = cdev_by_name(partname);
+	cdev = cdev_open_by_name(partname, O_RDONLY);
 	if (cdev == NULL) {
 		pr_err("Failed to get device %s\n", partname);
 		goto out;
 	}
 
 	rootpath = cdev_mount_default(cdev, NULL);
+
+	cdev_close(cdev);
+
 	if (IS_ERR(rootpath)) {
 		pr_err("Failed to load environment: mount %s failed (%ld)\n",
 						cdev->name, PTR_ERR(rootpath));
-- 
2.39.2





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux