mei: implement mei_cl_connect function
Hello Tomas Winkler,
The patch 9f81abdac362: "mei: implement mei_cl_connect function" from Jan 8, 2013, leads to the following static checker warning:
"drivers/misc/mei/main.c:522 mei_ioctl_connect_client()
warn: check 'dev->me_clients[]' for negative offsets (-2)"
drivers/misc/mei/main.c
490 /* find ME client we're trying to connect to */
491 i = mei_me_cl_by_uuid(dev, &data->in_client_uuid);
492 if (i >= 0 && !dev->me_clients[i].props.fixed_address) {
^^^^^^We check that i is not -ENOENT here.
493 cl->me_client_id = dev->me_clients[i].client_id;
494 cl->state = MEI_FILE_CONNECTING;
495 }
496
497 dev_dbg(&dev->pdev->dev, "Connect to FW Client ID = %d\n",
498 cl->me_client_id);
499 dev_dbg(&dev->pdev->dev, "FW Client - Protocol Version = %d\n",
500 dev->me_clients[i].props.protocol_version);
^^^^^^^^^^^^^^^^^^But on the rest of the function -ENOENT is not handled as an error.
501 dev_dbg(&dev->pdev->dev, "FW Client - Max Msg Len = %d\n",
502 dev->me_clients[i].props.max_msg_length);
503
regards,
dan carpenter