Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35637d0f authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "trace: convert to debugfs_file_get() and -put()"

parents 49dee689 ed33bef3
Loading
Loading
Loading
Loading
+10 −8
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2012-2015, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2015, 2017-2018, The Linux Foundation. All rights reserved.
 */

#include <linux/slab.h>
@@ -70,17 +70,18 @@ static ssize_t debug_read_helper(struct file *file, char __user *buff,
	struct dentry *d = file->f_path.dentry;
	char *buffer;
	int bsize;
	int srcu_idx;
	int r;

	r = debugfs_use_file_start(d, &srcu_idx);
	if (!r) {
	r = debugfs_file_get(d);
	if (r)
		return r;

	ilctxt = file->private_data;
	r = kref_get_unless_zero(&ilctxt->refcount) ? 0 : -EIO;
	}
	debugfs_use_file_finish(srcu_idx);
	if (r)
	if (r) {
		debugfs_file_put(d);
		return r;
	}

	buffer = kmalloc(count, GFP_KERNEL);
	if (!buffer) {
@@ -102,6 +103,7 @@ static ssize_t debug_read_helper(struct file *file, char __user *buff,

done:
	ipc_log_context_put(ilctxt);
	debugfs_file_put(d);
	return bsize;
}