Print this page
6659 nvlist_free(NULL) is a no-op


 326                 } else {
 327                         nvf_error(
 328                             "%s: nvlist add error %d (devid)\n",
 329                             nvf_cache_name(fd), rval);
 330                         goto err;
 331                 }
 332 
 333                 rval = nvlist_add_nvlist(nvl, np->nvp_devpath, sub_nvl);
 334                 if (rval != 0) {
 335                         nvf_error("%s: nvlist add error %d (sublist)\n",
 336                             nvf_cache_name(fd), rval);
 337                         goto err;
 338                 }
 339                 nvlist_free(sub_nvl);
 340         }
 341 
 342         *ret_nvl = nvl;
 343         return (DDI_SUCCESS);
 344 
 345 err:
 346         if (sub_nvl)
 347                 nvlist_free(sub_nvl);
 348         nvlist_free(nvl);
 349         *ret_nvl = NULL;
 350         return (DDI_FAILURE);
 351 }
 352 
 353 static int
 354 e_devid_do_discovery(void)
 355 {
 356         ASSERT(mutex_owned(&devid_discovery_mutex));
 357 
 358         if (i_ddi_io_initialized() == 0) {
 359                 if (devid_discovery_boot > 0) {
 360                         devid_discovery_boot--;
 361                         return (1);
 362                 }
 363         } else {
 364                 if (devid_discovery_postboot_always > 0)
 365                         return (1);
 366                 if (devid_discovery_postboot > 0) {




 326                 } else {
 327                         nvf_error(
 328                             "%s: nvlist add error %d (devid)\n",
 329                             nvf_cache_name(fd), rval);
 330                         goto err;
 331                 }
 332 
 333                 rval = nvlist_add_nvlist(nvl, np->nvp_devpath, sub_nvl);
 334                 if (rval != 0) {
 335                         nvf_error("%s: nvlist add error %d (sublist)\n",
 336                             nvf_cache_name(fd), rval);
 337                         goto err;
 338                 }
 339                 nvlist_free(sub_nvl);
 340         }
 341 
 342         *ret_nvl = nvl;
 343         return (DDI_SUCCESS);
 344 
 345 err:

 346         nvlist_free(sub_nvl);
 347         nvlist_free(nvl);
 348         *ret_nvl = NULL;
 349         return (DDI_FAILURE);
 350 }
 351 
 352 static int
 353 e_devid_do_discovery(void)
 354 {
 355         ASSERT(mutex_owned(&devid_discovery_mutex));
 356 
 357         if (i_ddi_io_initialized() == 0) {
 358                 if (devid_discovery_boot > 0) {
 359                         devid_discovery_boot--;
 360                         return (1);
 361                 }
 362         } else {
 363                 if (devid_discovery_postboot_always > 0)
 364                         return (1);
 365                 if (devid_discovery_postboot > 0) {