mei: hbm: drop BUG() from the hbm handler
Subsystems (2)
PATCH 1/3 mei: hbm: drop BUG() from the hbm handler
Drop BUG() from the hbm handler in order not to crash the whole kernel on faulty firmware implementation. Instead of it, just return an error resulting into link reset.
There is no any known issue of faulty firmware in this matter, the change is just to ease the development.
--- drivers/misc/mei/hbm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/mei/hbm.c +2 -2
@@ -1271,8 +1271,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)break ;default : -BUG (); -break ; +WARN (1 ,"hbm: wrong command %d\n" , mei_msg->hbm_cmd); +return -EPROTO ; }return 0 ;
Signature · 1 line
2.14.5
PATCH 2/3 mei: flush queues by the host client only
From: Alexander Usyskin <[email protected]>
During queues flush, the me client in most cases is already unlinked hence the me client id is unavailable. The host client structure pointer is enough for identification.
The function mei_cl_cmp_id() is dropped as it has no more usage.
--- drivers/misc/mei/client.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/misc/mei/client.c +2 -19
@@ -317,23 +317,6 @@ void mei_me_cl_rm_all(struct mei_device *dev)up_write (&dev->me_clients_rwsem); } -/** -* mei_cl_cmp_id - tells if the clients are the same -* -* @cl1: host client 1 -* @cl2: host client 2 -* -* Return: true - if the clients has same host and me ids -* false - otherwise -*/ -static inline bool mei_cl_cmp_id (const struct mei_cl *cl1, -const struct mei_cl *cl2) -{ -return cl1 && cl2 && - (cl1->host_client_id == cl2->host_client_id) && - (mei_cl_me_id (cl1) ==mei_cl_me_id (cl2)); -} -/** * mei_io_cb_free - free mei_cb_private related memory *
@@ -418,7 +401,7 @@ static void mei_io_list_flush_cl(struct list_head *head,struct mei_cl_cb *cb, *next;list_for_each_entry_safe (cb, next, head, list) { -if (mei_cl_cmp_id (cl, cb->cl)) +if (cl == cb->cl)list_del_init (&cb->list); } }
@@ -435,7 +418,7 @@ static void mei_io_tx_list_free_cl(struct list_head *head,struct mei_cl_cb *cb, *next;list_for_each_entry_safe (cb, next, head, list) { -if (mei_cl_cmp_id (cl, cb->cl)) +if (cl == cb->cl)mei_tx_cb_dequeue (cb); } }
Signature · 1 line
2.14.5
PATCH 3/3 mei: expedite ioctl return on the notify set operation error
In reply to Tomas WinklerFrom: Alexander Usyskin <[email protected]>
The notify set operation ioctl will wait till timeout is expired even in case when the FW returned an error.
Check the status field of the client object in wait_event_timeout() to determine if the caller can return earlier.
--- drivers/misc/mei/client.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/mei/client.c +3 -1
@@ -1357,7 +1357,9 @@ int mei_cl_notify_request(struct mei_cl *cl,mutex_unlock (&dev->device_lock);wait_event_timeout (cl->wait, - cl->notify_en == request || !mei_cl_is_connected (cl), + cl->notify_en == request || + cl->status || + !mei_cl_is_connected (cl),mei_secs_to_jiffies (MEI_CL_CONNECT_TIMEOUT ));mutex_lock (&dev->device_lock);
Signature · 1 line
2.14.5