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

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

Merge "msm: ipa: address static analysis issues"

parents 700c5d87 e62a36a9
Loading
Loading
Loading
Loading
+18 −22
Original line number Diff line number Diff line
@@ -395,12 +395,6 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
	ECM_IPA_DEBUG("usb_to_ipa_hdl = %d, ipa_to_usb_hdl = %d, priv=0x%p\n",
					usb_to_ipa_hdl, ipa_to_usb_hdl, priv);

	ecm_msg = kzalloc(sizeof(struct ipa_ecm_msg), GFP_KERNEL);
	if (!ecm_msg) {
		ECM_IPA_ERROR("can't alloc msg mem\n");
		return -ENOMEM;
	}

	next_state = ecm_ipa_next_state(ecm_ipa_ctx->state, ECM_IPA_CONNECT);
	if (next_state == ECM_IPA_INVALID) {
		ECM_IPA_ERROR("can't call connect before calling initialize\n");
@@ -419,17 +413,24 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
				ipa_to_usb_hdl);
		return -EINVAL;
	}

	ecm_ipa_ctx->ipa_to_usb_hdl = ipa_to_usb_hdl;
	ecm_ipa_ctx->usb_to_ipa_hdl = usb_to_ipa_hdl;
	retval = ecm_ipa_ep_registers_cfg(usb_to_ipa_hdl, ipa_to_usb_hdl);
	if (retval) {
		ECM_IPA_ERROR("fail on ep cfg\n");
		goto fail_ep;
		return retval;
	}
	ECM_IPA_DEBUG("end-point configured\n");

	netif_carrier_on(ecm_ipa_ctx->net);

	ecm_msg = kzalloc(sizeof(struct ipa_ecm_msg), GFP_KERNEL);
	if (!ecm_msg) {
		ECM_IPA_ERROR("can't alloc msg mem\n");
		return -ENOMEM;
	}

	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
	msg_meta.msg_type = ECM_CONNECT;
	msg_meta.msg_len = sizeof(struct ipa_ecm_msg);
@@ -440,13 +441,13 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
	retval = ipa_send_msg(&msg_meta, ecm_msg, ecm_ipa_msg_free_cb);
	if (retval) {
		ECM_IPA_ERROR("fail to send ECM_CONNECT message\n");
		goto fail_msg;
		kfree(ecm_msg);
		return retval;
	}

	if (!netif_carrier_ok(ecm_ipa_ctx->net)) {
		ECM_IPA_ERROR("netif_carrier_ok error\n");
		retval = -EBUSY;
		goto fail_carrier;
		return -EBUSY;
	}
	ECM_IPA_DEBUG("carrier_on notified\n");

@@ -460,12 +461,6 @@ int ecm_ipa_connect(u32 usb_to_ipa_hdl, u32 ipa_to_usb_hdl,
	ECM_IPA_LOG_EXIT();

	return 0;

fail_carrier:
fail_msg:
	kfree(ecm_msg);
fail_ep:
	return retval;
}
EXPORT_SYMBOL(ecm_ipa_connect);

@@ -694,12 +689,6 @@ int ecm_ipa_disconnect(void *priv)
	NULL_CHECK(ecm_ipa_ctx);
	ECM_IPA_DEBUG("priv=0x%p\n", priv);

	ecm_msg = kzalloc(sizeof(struct ipa_ecm_msg), GFP_KERNEL);
	if (!ecm_msg) {
		ECM_IPA_ERROR("can't alloc msg mem\n");
		return -ENOMEM;
	}

	next_state = ecm_ipa_next_state(ecm_ipa_ctx->state, ECM_IPA_DISCONNECT);
	if (next_state == ECM_IPA_INVALID) {
		ECM_IPA_ERROR("can't disconnect before connect\n");
@@ -711,6 +700,12 @@ int ecm_ipa_disconnect(void *priv)
	netif_carrier_off(ecm_ipa_ctx->net);
	ECM_IPA_DEBUG("carrier_off notifcation was sent\n");

	ecm_msg = kzalloc(sizeof(struct ipa_ecm_msg), GFP_KERNEL);
	if (!ecm_msg) {
		ECM_IPA_ERROR("can't alloc msg mem\n");
		return -ENOMEM;
	}

	memset(&msg_meta, 0, sizeof(struct ipa_msg_meta));
	msg_meta.msg_type = ECM_DISCONNECT;
	msg_meta.msg_len = sizeof(struct ipa_ecm_msg);
@@ -908,6 +903,7 @@ static void ecm_ipa_rules_destroy(struct ecm_ipa_dev *ecm_ipa_ctx)
	result = ipa_del_hdr(del_hdr);
	if (result || ipv4->status || ipv6->status)
		ECM_IPA_ERROR("ipa_del_hdr failed\n");
	kfree(del_hdr);
}

/* ecm_ipa_register_properties() - set Tx/Rx properties for ipacm
+1 −0
Original line number Diff line number Diff line
@@ -1516,6 +1516,7 @@ static int rndis_ipa_hdrs_destroy(struct rndis_ipa_dev *rndis_ipa_ctx)
	else
		RNDIS_IPA_DEBUG("hdrs deletion done\n");

	kfree(del_hdr);
	return result;
}

+4 −6
Original line number Diff line number Diff line
@@ -1986,7 +1986,6 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
	struct sps_bam_props bam_props = { 0 };
	struct ipa_flt_tbl *flt_tbl;
	struct ipa_rt_tbl_set *rset;
	struct ipa_controller *ctrl;

	IPADBG("IPA Driver initialization started\n");

@@ -2008,20 +2007,19 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
	ipa_ctx->aggregation_byte_limit = 1;
	ipa_ctx->aggregation_time_limit = 0;

	ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
	if (!ctrl) {
	ipa_ctx->ctrl = kzalloc(sizeof(*ipa_ctx->ctrl), GFP_KERNEL);
	if (!ipa_ctx->ctrl) {
		IPAERR("memory allocation error for ctrl\n");
		result = -ENOMEM;
		goto fail_mem_ctrl;
	}
	result = ipa_controller_static_bind(ctrl,
	result = ipa_controller_static_bind(ipa_ctx->ctrl,
			ipa_ctx->ipa_hw_type);
	if (result) {
		IPAERR("fail to static bind IPA ctrl.\n");
		result = -EFAULT;
		goto fail_bind;
	}
	ipa_ctx->ctrl = ctrl;

	IPADBG("hdr_lcl=%u ip4_rt=%u ip6_rt=%u ip4_flt=%u ip6_flt=%u\n",
	       ipa_ctx->hdr_tbl_lcl, ipa_ctx->ip4_rt_tbl_lcl,
@@ -2067,7 +2065,7 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
	}
	IPADBG("IPA HW initialization sequence completed");

	ctrl->ipa_sram_read_settings();
	ipa_ctx->ctrl->ipa_sram_read_settings();
	IPADBG("SRAM, size: 0x%x, restricted bytes: 0x%x\n",
		ipa_ctx->smem_sz, ipa_ctx->smem_restricted_bytes);

+1 −1
Original line number Diff line number Diff line
@@ -445,7 +445,7 @@ int ipa_reset_endpoint(u32 clnt_hdl)
	int res;
	struct ipa_ep_context *ep;

	if (clnt_hdl < 0 || clnt_hdl >= IPA_CLIENT_MAX) {
	if (clnt_hdl >= IPA_NUM_PIPES) {
		IPAERR("Bad parameters.\n");
		return -EFAULT;
	}
+10 −4
Original line number Diff line number Diff line
@@ -583,8 +583,11 @@ static void ipa_sps_irq_cmd_ack(void *user1, int user2)
{
	struct ipa_desc *desc = (struct ipa_desc *)user1;

	if (!desc)
	if (!desc) {
		IPAERR("desc is NULL\n");
		WARN_ON(1);
		return;
	}
	IPADBG("got ack for cmd=%d\n", desc->opcode);
	complete(&desc->xfer_done);
}
@@ -917,9 +920,12 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
	dma_addr_t dma_addr;
	char buff[IPA_RESOURCE_NAME_MAX];

	if (sys_in == NULL || clnt_hdl == NULL ||
	    sys_in->client >= IPA_CLIENT_MAX ||
			sys_in->desc_fifo_sz == 0) {
	if (sys_in == NULL || clnt_hdl == NULL) {
		IPAERR("NULL args\n");
		goto fail_gen;
	}

	if (sys_in->client >= IPA_CLIENT_MAX || sys_in->desc_fifo_sz == 0) {
		IPAERR("bad parm client:%d fifo_sz:%d\n",
			sys_in->client, sys_in->desc_fifo_sz);
		goto fail_gen;
Loading