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

Commit 20347c3a authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "diag: Add checks in initialization functions"

parents 2bafc859 1cd84079
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -2379,7 +2379,7 @@ err:

int diag_dci_init(void)
{
	int success = 0;
	int ret = 0;
	int i;

	driver->dci_tag = 0;
@@ -2390,22 +2390,22 @@ int diag_dci_init(void)
	mutex_init(&dci_event_mask_mutex);
	spin_lock_init(&ws_lock);

	success = diag_dci_init_ops_tbl();
	if (success)
	ret = diag_dci_init_ops_tbl();
	if (ret)
		goto err;

	for (i = 0; i < NUM_SMD_DCI_CHANNELS; i++) {
		success = diag_smd_constructor(&driver->smd_dci[i], i,
		ret = diag_smd_constructor(&driver->smd_dci[i], i,
							SMD_DCI_TYPE);
		if (!success)
		if (ret)
			goto err;
	}

	if (driver->supports_separate_cmdrsp) {
		for (i = 0; i < NUM_SMD_DCI_CMD_CHANNELS; i++) {
			success = diag_smd_constructor(&driver->smd_dci_cmd[i],
			ret = diag_smd_constructor(&driver->smd_dci_cmd[i],
							i, SMD_DCI_CMD_TYPE);
			if (!success)
			if (ret)
				goto err;
		}
	}
@@ -2419,15 +2419,18 @@ int diag_dci_init(void)
	INIT_LIST_HEAD(&driver->dci_req_list);

	driver->diag_dci_wq = create_singlethread_workqueue("diag_dci_wq");
	if (!driver->diag_dci_wq)
		goto err;

	INIT_WORK(&dci_data_drain_work, dci_data_drain_work_fn);
	success = platform_driver_register(&msm_diag_dci_driver);
	if (success) {
	ret = platform_driver_register(&msm_diag_dci_driver);
	if (ret) {
		pr_err("diag: Could not register DCI driver\n");
		goto err;
	}
	if (driver->supports_separate_cmdrsp) {
		success = platform_driver_register(&msm_diag_dci_cmd_driver);
		if (success) {
		ret = platform_driver_register(&msm_diag_dci_cmd_driver);
		if (ret) {
			pr_err("diag: Could not register DCI cmd driver\n");
			goto err;
		}
+39 −18
Original line number Diff line number Diff line
@@ -784,33 +784,49 @@ const struct file_operations diag_dbgfs_dcistats_ops = {
	.read = diag_dbgfs_read_dcistats,
};

void diag_debugfs_init(void)
int diag_debugfs_init(void)
{
	struct dentry *entry = NULL;

	diag_dbgfs_dent = debugfs_create_dir("diag", 0);
	if (IS_ERR(diag_dbgfs_dent))
		return;
		return -ENOMEM;

	debugfs_create_file("status", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("status", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_status_ops);
	if (!entry)
		goto err;

	debugfs_create_file("table", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("table", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_table_ops);
	if (!entry)
		goto err;

	debugfs_create_file("work_pending", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("work_pending", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_workpending_ops);
	if (!entry)
		goto err;

	debugfs_create_file("mempool", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("mempool", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_mempool_ops);
	if (!entry)
		goto err;

	debugfs_create_file("dci_stats", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("dci_stats", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_dcistats_ops);
	if (!entry)
		goto err;

#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
	debugfs_create_file("bridge", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("bridge", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_bridge_ops);
	if (!entry)
		goto err;

	debugfs_create_file("bridge_dci", 0444, diag_dbgfs_dent, 0,
	entry = debugfs_create_file("bridge_dci", 0444, diag_dbgfs_dent, 0,
				    &diag_dbgfs_bridge_dci_ops);
	if (!entry)
		goto err;
#endif

	diag_dbgfs_table_index = 0;
@@ -825,6 +841,11 @@ void diag_debugfs_init(void)
		pr_warn("diag: could not allocate memory for dci debug info\n");

	mutex_init(&dci_stat_mutex);
	return 0;
err:
	kfree(dci_traffic);
	debugfs_remove_recursive(diag_dbgfs_dent);
	return -ENOMEM;
}

void diag_debugfs_cleanup(void)
@@ -838,6 +859,6 @@ void diag_debugfs_cleanup(void)
	mutex_destroy(&dci_stat_mutex);
}
#else
void diag_debugfs_init(void) { }
int diag_debugfs_init(void) { return 0; }
void diag_debugfs_cleanup(void) { }
#endif
+2 −2
Original line number Diff line number Diff line
/* Copyright (c)2012, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012, 2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -13,7 +13,7 @@
#ifndef DIAG_DEBUGFS_H
#define DIAG_DEBUGFS_H

void diag_debugfs_init(void);
int diag_debugfs_init(void);
void diag_debugfs_cleanup(void);

#endif
+3 −2
Original line number Diff line number Diff line
@@ -905,7 +905,7 @@ static void diag_log_mask_init(void)
	}
}

void diag_masks_init(void)
int diag_masks_init(void)
{
	driver->event_status = DIAG_CTRL_MASK_INVALID;
	driver->msg_status = DIAG_CTRL_MASK_INVALID;
@@ -990,7 +990,7 @@ void diag_masks_init(void)
			goto err;
		kmemleak_not_leak(driver->event_masks);
	}
	return;
	return 0;
err:
	pr_err("diag: Could not initialize diag mask buffers");
	kfree(driver->event_mask);
@@ -1001,6 +1001,7 @@ err:
	kfree(driver->event_masks);
	kfree(driver->feature_mask);
	kfree(driver->buf_feature_mask_update);
	return -ENOMEM;
}

void diag_masks_exit(void)
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ void diag_send_log_mask_update(struct diag_smd_info *smd_info, int);
void diag_mask_update_fn(struct work_struct *work);
void diag_send_feature_mask_update(struct diag_smd_info *smd_info);
int diag_process_apps_masks(unsigned char *buf, int len);
void diag_masks_init(void);
int diag_masks_init(void);
void diag_masks_exit(void);
extern int diag_event_num_bytes;
#endif
Loading