Print this page
patch tsoome-feedback

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_hc_sun4v.c
          +++ new/usr/src/cmd/fm/modules/sun4v/cpumem-diagnosis/cmd_hc_sun4v.c
↓ open down ↓ 192 lines elided ↑ open up ↑
 193  193  
 194  194          hc_list = fmd_hdl_zalloc(hdl, sizeof (nvlist_t *)*n, FMD_SLEEP);
 195  195  
 196  196          for (i = 0; i < n; i++) {
 197  197                  (void) nvlist_alloc(&hc_list[i],
 198  198                      NV_UNIQUE_NAME|NV_UNIQUE_NAME_TYPE, 0);
 199  199          }
 200  200  
 201  201          if (cmd_breakup_components(nac, "/", hc_list) < 0) {
 202  202                  for (i = 0; i < n; i++) {
 203      -                        if (hc_list[i] != NULL)
 204      -                            nvlist_free(hc_list[i]);
      203 +                        nvlist_free(hc_list[i]);
 205  204                  }
 206  205                  fmd_hdl_free(hdl, hc_list, sizeof (nvlist_t *)*n);
 207  206                  fmd_hdl_free(hdl, nac, len);
 208  207                  return (NULL);
 209  208          }
 210  209  
 211  210          if (nvlist_alloc(&fru, NV_UNIQUE_NAME, 0) != 0) {
 212  211                  for (i = 0; i < n; i++) {
 213      -                        if (hc_list[i] != NULL)
 214      -                            nvlist_free(hc_list[i]);
      212 +                        nvlist_free(hc_list[i]);
 215  213                  }
 216  214                  fmd_hdl_free(hdl, hc_list, sizeof (nvlist_t *)*n);
 217  215                  fmd_hdl_free(hdl, nac, len);
 218  216                  return (NULL);
 219  217          }
 220  218  
 221  219          if (nvlist_add_uint8(fru, FM_VERSION, FM_HC_SCHEME_VERSION) != 0 ||
 222  220              nvlist_add_string(fru, FM_FMRI_SCHEME, FM_FMRI_SCHEME_HC) != 0 ||
 223  221              nvlist_add_string(fru, FM_FMRI_HC_ROOT, "") != 0 ||
 224  222              nvlist_add_uint32(fru, FM_FMRI_HC_LIST_SZ, n) != 0 ||
 225  223              nvlist_add_nvlist_array(fru, FM_FMRI_HC_LIST, hc_list, n) != 0) {
 226  224                  for (i = 0; i < n; i++) {
 227      -                        if (hc_list[i] != NULL)
 228      -                            nvlist_free(hc_list[i]);
      225 +                        nvlist_free(hc_list[i]);
 229  226                  }
 230  227                  fmd_hdl_free(hdl, hc_list, sizeof (nvlist_t *)*n);
 231  228                  fmd_hdl_free(hdl, nac, len);
 232  229                  nvlist_free(fru);
 233  230                  return (NULL);
 234  231          }
 235  232  
 236  233          for (i = 0; i < n; i++) {
 237      -                if (hc_list[i] != NULL)
 238      -                    nvlist_free(hc_list[i]);
      234 +                nvlist_free(hc_list[i]);
 239  235          }
 240  236          fmd_hdl_free(hdl, hc_list, sizeof (nvlist_t *)*n);
 241  237          fmd_hdl_free(hdl, nac, len);
 242  238  
 243  239          if ((serialstr != NULL &&
 244  240              nvlist_add_string(fru, FM_FMRI_HC_SERIAL_ID, serialstr) != 0) ||
 245  241              (partstr != NULL &&
 246  242              nvlist_add_string(fru, FM_FMRI_HC_PART, partstr) != 0)) {
 247  243                  nvlist_free(fru);
 248  244                  return (NULL);
↓ open down ↓ 16 lines elided ↑ open up ↑
 265  261                  serialstr = NULL;
 266  262          if (nvlist_lookup_string(asru, FM_FMRI_HC_PART, &partstr) != 0)
 267  263                  partstr = NULL;
 268  264  
 269  265          nvlfru = cmd_mkboard_fru(hdl, loc, serialstr, partstr);
 270  266          if (nvlfru == NULL)
 271  267                  return (NULL);
 272  268  
 273  269          flt = cmd_nvl_create_fault(hdl, fltnm, cert, nvlfru, nvlfru, NULL);
 274  270          flt = cmd_fault_add_location(hdl, flt, loc);
 275      -        if (nvlfru != NULL)
 276      -                nvlist_free(nvlfru);
      271 +        nvlist_free(nvlfru);
 277  272          return (flt);
 278  273  }
 279  274  
 280  275  /* find_mb -- find hardware platform motherboard within libtopo */
 281  276  
 282  277  /* ARGSUSED */
 283  278  static int
 284  279  find_mb(topo_hdl_t *thp, tnode_t *node, void *arg)
 285  280  {
 286  281          int err;
↓ open down ↓ 344 lines elided ↑ open up ↑
 631  626                                      FM_FMRI_MEM_OFFSET, &offset) == 0)
 632  627                                          (void) nvlist_add_uint64(hsp,
 633  628                                              FM_FMRI_HC_SPECIFIC_OFFSET, offset);
 634  629  
 635  630                                  (void) nvlist_add_nvlist(rsrc,
 636  631                                      FM_FMRI_HC_SPECIFIC, hsp);
 637  632                          }
 638  633                  }
 639  634                  fllist = fmd_nvl_create_fault(hdl, class, cert, asru,
 640  635                      fru, rsrc);
 641      -                if (hsp != NULL)
 642      -                        nvlist_free(hsp);
      636 +                nvlist_free(hsp);
 643  637          } else {
 644  638                  rsrc = get_cpu_fault_resource(hdl, asru);
 645  639                  fllist = fmd_nvl_create_fault(hdl, class, cert, asru,
 646  640                      fru, rsrc);
 647  641          }
 648  642  
 649      -        if (rsrc != NULL)
 650      -                nvlist_free(rsrc);
      643 +        nvlist_free(rsrc);
 651  644  
 652  645          return (fllist);
 653  646  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX