Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/intel/io/heci/heci_init.c
          +++ new/usr/src/uts/intel/io/heci/heci_init.c
↓ open down ↓ 776 lines elided ↑ open up ↑
 777  777          if (dev->me_clients) {
 778  778                  kmem_free(dev->me_clients, dev->num_heci_me_clients*
 779  779                      sizeof (struct heci_me_client));
 780  780                  dev->me_clients = NULL;
 781  781          }
 782  782          mutex_exit(&dev->device_lock);
 783  783  
 784  784          /* allocate storage for ME clients representation */
 785  785          clients = kmem_zalloc(dev->num_heci_me_clients*
 786  786              sizeof (struct heci_me_client), KM_SLEEP);
 787      -        if (!clients) {
 788      -                DBG("memory allocation for ME clients failed.\n");
 789      -                return (-ENOMEM);
 790      -        }
 791  787  
 792  788          mutex_enter(&dev->device_lock);
 793  789          dev->me_clients = clients;
 794  790          mutex_exit(&dev->device_lock);
 795  791  
 796  792          num = 0;
 797  793          for (i = 0; i < sizeof (dev->heci_me_clients); i++) {
 798  794                  for (j = 0; j < 8; j++) {
 799  795                          if ((dev->heci_me_clients[i] & (1 << j)) != 0) {
 800  796                                  client = &dev->me_clients[num];
↓ open down ↓ 243 lines elided ↑ open up ↑
1044 1040   * @file: the file structure
1045 1041   *
1046 1042   * @return  The allocated file or NULL on failure
1047 1043   */
1048 1044  struct heci_file_private *
1049 1045  heci_alloc_file_private(struct heci_file *file)
1050 1046  {
1051 1047          struct heci_file_private *priv;
1052 1048  
1053 1049          priv = kmem_zalloc(sizeof (struct heci_file_private), KM_SLEEP);
1054      -        if (!priv)
1055      -                return (NULL);
1056 1050  
1057 1051          heci_init_file_private(priv, file);
1058 1052  
1059 1053          return (priv);
1060 1054  }
1061 1055  
1062 1056  /*
1063 1057   * heci_free_file_private - free a private file structure that were previously
1064 1058   * allocated by heci_alloc_file_private
1065 1059   */
↓ open down ↓ 26 lines elided ↑ open up ↑
1092 1086          struct heci_cb_private *priv_cb;
1093 1087          clock_t delta = (clock_t)(timeout * HZ);
1094 1088  
1095 1089          if ((!dev) || (!file_ext))
1096 1090                  return (-ENODEV);
1097 1091  
1098 1092          if (file_ext->state != HECI_FILE_DISCONNECTING)
1099 1093                  return (0);
1100 1094  
1101 1095          priv_cb = kmem_zalloc(sizeof (struct heci_cb_private), KM_SLEEP);
1102      -        if (!priv_cb)
1103      -                return (-ENOMEM);
1104 1096  
1105 1097          LIST_INIT_HEAD(&priv_cb->cb_list);
1106 1098          priv_cb->file_private = file_ext;
1107 1099          priv_cb->major_file_operations = HECI_CLOSE;
1108 1100          mutex_enter(&dev->device_lock);
1109 1101          if (dev->host_buffer_is_empty) {
1110 1102                  dev->host_buffer_is_empty = 0;
1111 1103                  if (heci_disconnect(dev, file_ext)) {
1112 1104                          list_add_tail(&priv_cb->cb_list,
1113 1105                              &dev->ctrl_rd_list.heci_cb.cb_list);
↓ open down ↓ 90 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX