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

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

Merge "msm: mhi_dev: initialize variables to default values"

parents 8486b7c5 66b500df
Loading
Loading
Loading
Loading
+4 −19
Original line number Diff line number Diff line
@@ -96,9 +96,6 @@ void mhi_dev_read_from_host(struct mhi_dev *mhi, struct mhi_addr *transfer)
					host_addr_pa, (int) transfer->size);
		if (rc)
			pr_err("error while reading from host:%d\n", rc);
	} else {
		memcpy(transfer->virt_addr, (void *) &transfer->device_va,
					(int) transfer->size);
	}
}
EXPORT_SYMBOL(mhi_dev_read_from_host);
@@ -134,11 +131,6 @@ void mhi_dev_write_to_host(struct mhi_dev *mhi,
			(u64) mhi->cache_dma_handle, (int) transfer->size);
		if (rc)
			pr_err("error while reading from host:%d\n", rc);
	} else {
		memcpy((void *) &transfer->device_va, transfer->virt_addr,
							transfer->size);
		/* Update state before sending events */
		wmb();
	}
}
EXPORT_SYMBOL(mhi_dev_write_to_host);
@@ -472,12 +464,8 @@ static void mhi_dev_fetch_ch_ctx(struct mhi_dev *mhi, uint32_t ch_id)
					sizeof(struct mhi_dev_ch_ctx) * ch_id;
		data_transfer.phy_addr = mhi->ch_ctx_cache_dma_handle +
					sizeof(struct mhi_dev_ch_ctx) * ch_id;
	} else {
		data_transfer.device_va = mhi->ch_ctx_shadow.device_va +
					sizeof(struct mhi_dev_ch_ctx) * ch_id;
		data_transfer.virt_addr = mhi->cmd_ctx_cache +
					sizeof(struct mhi_dev_ch_ctx) * ch_id;
	}

	data_transfer.size  = sizeof(struct mhi_dev_ch_ctx);
	/* Fetch the channel ctx (*dst, *src, size) */
	mhi_dev_read_from_host(mhi, &data_transfer);
@@ -510,6 +498,7 @@ int mhi_dev_send_event(struct mhi_dev *mhi, int evnt_ring,
	struct mhi_addr transfer_addr;
	uint32_t data_buffer = 0;

	memset(&msi_addr, 0, sizeof(msi_addr));
	rc = ep_pcie_get_msi_config(mhi->phandle, &cfg);
	if (rc) {
		pr_err("Error retrieving pcie msi logic\n");
@@ -1302,10 +1291,8 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
	if (mhi->use_ipa) {
		data_transfer.phy_addr = mhi->cmd_ctx_cache_dma_handle;
		data_transfer.host_pa = mhi->cmd_ctx_shadow.host_pa;
	} else {
		data_transfer.device_va = mhi->cmd_ctx_shadow.device_va;
		data_transfer.virt_addr = mhi->cmd_ctx_cache;
	}

	data_transfer.size = mhi->cmd_ctx_shadow.size;

	/* Cache the command and event context */
@@ -1314,10 +1301,8 @@ static int mhi_dev_cache_host_cfg(struct mhi_dev *mhi)
	if (mhi->use_ipa) {
		data_transfer.phy_addr = mhi->ev_ctx_cache_dma_handle;
		data_transfer.host_pa = mhi->ev_ctx_shadow.host_pa;
	} else {
		data_transfer.device_va = mhi->ev_ctx_shadow.device_va;
		data_transfer.virt_addr = mhi->ev_ctx_cache;
	}

	data_transfer.size = mhi->ev_ctx_shadow.size;

	mhi_dev_read_from_host(mhi, &data_transfer);
+6 −1
Original line number Diff line number Diff line
@@ -253,6 +253,11 @@ static ssize_t mhi_dev_net_client_read(struct mhi_dev_net_client *mhi_handle)
	do {
		start_time = ktime_get();
		skb_buff = alloc_skb(MHI_NET_DEFAULT_MTU, GFP_ATOMIC);
		if (!skb_buff) {
			mhi_dev_net_log(MHI_ERROR,
				"Error while allocating skb\n");
			return -ENOMEM;
		}
		bytes_avail = mhi_dev_read_channel(client_handle,
				skb_buff->data,
				buf_size, &chained);
@@ -499,7 +504,7 @@ int mhi_dev_net_interface_init(void)
	struct mhi_dev_net_client *mhi_net_client = NULL;

	mhi_net_client = kzalloc(sizeof(struct mhi_dev_net_client), GFP_KERNEL);
	if (mhi_net_client < 0)
	if (!mhi_net_client)
		return -ENOMEM;

	mhi_net_ipc_log = ipc_log_context_create(MHI_NET_IPC_PAGES,
+4 −3
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, 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
@@ -438,7 +438,7 @@ static int mhi_sm_change_to_M0(void)
{
	enum mhi_dev_state old_state;
	struct ep_pcie_msi_config cfg;
	int res;
	int res = -EINVAL;

	MHI_SM_FUNC_ENTRY();

@@ -983,7 +983,7 @@ EXPORT_SYMBOL(mhi_dev_sm_get_mhi_state);
 */
int mhi_dev_sm_set_ready(void)
{
	int res;
	int res = -EAGAIN;
	int is_ready;
	enum mhi_dev_state state;

@@ -1030,6 +1030,7 @@ int mhi_dev_sm_set_ready(void)
		goto unlock_and_exit;
	}
	mhi_sm_mmio_set_mhistatus(MHI_DEV_READY_STATE);
	res = 0;

unlock_and_exit:
	mutex_unlock(&mhi_sm_ctx->mhi_state_lock);
+6 −4
Original line number Diff line number Diff line
/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015,2017, 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
@@ -337,18 +337,20 @@ static int mhi_uci_client_release(struct inode *mhi_inode,
		struct file *file_handle)
{
	struct uci_client *uci_handle = file_handle->private_data;
	struct mhi_uci_ctxt_t *uci_ctxt = uci_handle->uci_ctxt;
	struct mhi_uci_ctxt_t *uci_ctxt;
	u32 nr_in_bufs = 0;
	int rc = 0;
	int in_chan = 0;
	u32 buf_size = 0;

	if (!uci_handle)
		return -EINVAL;

	uci_ctxt = uci_handle->uci_ctxt;
	in_chan = iminor(mhi_inode) + 1;
	nr_in_bufs = uci_ctxt->chan_attrib[in_chan].nr_trbs;
	buf_size = uci_ctxt->chan_attrib[in_chan].max_packet_size;

	if (!uci_handle)
		return -EINVAL;
	if (atomic_sub_return(1, &uci_handle->ref_count) == 0) {
		uci_log(UCI_DBG_DBG,
				"Last client left, closing channel 0x%x\n",