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

Commit 140c7553 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman
Browse files

mei: drop unneeded client NULL check in cb structure



The pointer to client in the callback structure (cb->cl)
can't be NULL with current locking.
We can drop check and warnings as in some cases this just
uselessly complicates the code flow.

Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0df1f248
Loading
Loading
Loading
Loading
+9 −15
Original line number Diff line number Diff line
@@ -360,8 +360,7 @@ int mei_amthif_write(struct mei_device *dev, struct mei_cl_cb *cb)
void mei_amthif_run_next_cmd(struct mei_device *dev)
{
	struct mei_cl_cb *cb;
	struct mei_cl_cb *next;
	int status;
	int ret;

	if (!dev)
		return;
@@ -376,16 +375,14 @@ void mei_amthif_run_next_cmd(struct mei_device *dev)

	dev_dbg(dev->dev, "complete amthif cmd_list cb.\n");

	list_for_each_entry_safe(cb, next, &dev->amthif_cmd_list.list, list) {
	cb = list_first_entry_or_null(&dev->amthif_cmd_list.list,
					typeof(*cb), list);
	if (!cb)
		return;
	list_del(&cb->list);
		if (!cb->cl)
			continue;
		status = mei_amthif_send_cmd(dev, cb);
		if (status)
			dev_warn(dev->dev, "amthif write failed status = %d\n",
						status);
		break;
	}
	ret =  mei_amthif_send_cmd(dev, cb);
	if (ret)
		dev_warn(dev->dev, "amthif write failed status = %d\n", ret);
}


@@ -536,9 +533,6 @@ int mei_amthif_irq_read_msg(struct mei_device *dev,
	cb = dev->iamthif_current_cb;
	dev->iamthif_current_cb = NULL;

	if (!cb->cl)
		return -ENODEV;

	dev->iamthif_stall_timer = 0;
	cb->buf_idx = dev->iamthif_msg_buf_index;
	cb->read_time = jiffies;
+1 −1
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ static void __mei_io_list_flush(struct mei_cl_cb *list,

	/* enable removing everything if no cl is specified */
	list_for_each_entry_safe(cb, next, &list->list, list) {
		if (!cl || (cb->cl && mei_cl_cmp_id(cl, cb->cl))) {
		if (!cl || mei_cl_cmp_id(cl, cb->cl)) {
			list_del(&cb->list);
			if (free)
				mei_io_cb_free(cb);
+0 −5
Original line number Diff line number Diff line
@@ -637,11 +637,6 @@ static void mei_hbm_cl_res(struct mei_device *dev,
	list_for_each_entry_safe(cb, next, &dev->ctrl_rd_list.list, list) {

		cl = cb->cl;
		/* this should not happen */
		if (WARN_ON(!cl)) {
			list_del_init(&cb->list);
			continue;
		}

		if (cb->fop_type != fop_type)
			continue;
+1 −11
Original line number Diff line number Diff line
@@ -44,8 +44,6 @@ void mei_irq_compl_handler(struct mei_device *dev, struct mei_cl_cb *compl_list)
	list_for_each_entry_safe(cb, next, &compl_list->list, list) {
		cl = cb->cl;
		list_del(&cb->list);
		if (!cl)
			continue;

		dev_dbg(dev->dev, "completing call back.\n");
		if (cl == &dev->iamthif_cl)
@@ -105,7 +103,7 @@ static int mei_cl_irq_read_msg(struct mei_device *dev,

	list_for_each_entry_safe(cb, next, &dev->read_list.list, list) {
		cl = cb->cl;
		if (!cl || !mei_cl_is_reading(cl, mei_hdr))
		if (!mei_cl_is_reading(cl, mei_hdr))
			continue;

		cl->reading_state = MEI_READING;
@@ -449,8 +447,6 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
	list = &dev->write_waiting_list;
	list_for_each_entry_safe(cb, next, &list->list, list) {
		cl = cb->cl;
		if (cl == NULL)
			continue;

		cl->status = 0;
		list_del(&cb->list);
@@ -489,10 +485,6 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
	dev_dbg(dev->dev, "complete control write list cb.\n");
	list_for_each_entry_safe(cb, next, &dev->ctrl_wr_list.list, list) {
		cl = cb->cl;
		if (!cl) {
			list_del(&cb->list);
			return -ENODEV;
		}
		switch (cb->fop_type) {
		case MEI_FOP_DISCONNECT:
			/* send disconnect message */
@@ -530,8 +522,6 @@ int mei_irq_write_handler(struct mei_device *dev, struct mei_cl_cb *cmpl_list)
	dev_dbg(dev->dev, "complete write list cb.\n");
	list_for_each_entry_safe(cb, next, &dev->write_list.list, list) {
		cl = cb->cl;
		if (cl == NULL)
			continue;
		if (cl == &dev->iamthif_cl)
			ret = mei_amthif_irq_write(cl, cb, cmpl_list);
		else