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


 297                     !(n & 0x80000000)) {
 298                         cmn_err(CE_WARN, "%s: ERROR Reading crb_init area: "
 299                             "n: %08x\n", unm_nic_driver_name, n);
 300                         return (-1);
 301                 }
 302                 offset = 1;
 303                 n &= ~0x80000000;
 304         }
 305 
 306         if (n  >= 1024) {
 307                 cmn_err(CE_WARN, "%s: %s:n=0x%x Card flash not initialized\n",
 308                     unm_nic_driver_name, __FUNCTION__, n);
 309                 return (-1);
 310         }
 311 
 312         if (verbose)
 313                 cmn_err(CE_WARN, "%s: %d CRB init values found in ROM.\n",
 314                     unm_nic_driver_name, n);
 315 
 316         buf = kmem_zalloc(n * sizeof (struct crb_addr_pair), KM_SLEEP);
 317         if (buf == NULL) {
 318                 cmn_err(CE_WARN, "%s: pinit_from_rom: Unable to get memory\n",
 319                     unm_nic_driver_name);
 320                 return (-1);
 321         }
 322 
 323         for (i = 0; i < n; i++) {
 324                 if (rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
 325                     rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
 326                         kmem_free(buf, n * sizeof (struct crb_addr_pair));
 327                         return (-1);
 328                 }
 329 
 330                 buf[i].addr = addr;
 331                 buf[i].data = val;
 332 
 333                 if (verbose)
 334                         cmn_err(CE_WARN, "%s: PCI:     0x%08x == 0x%08x\n",
 335                             unm_nic_driver_name,
 336                             (unsigned int)decode_crb_addr(
 337                             (unsigned long)addr), val);
 338         }
 339 
 340         for (i = 0; i < n; i++) {
 341                 off = decode_crb_addr((unsigned long)buf[i].addr) +




 297                     !(n & 0x80000000)) {
 298                         cmn_err(CE_WARN, "%s: ERROR Reading crb_init area: "
 299                             "n: %08x\n", unm_nic_driver_name, n);
 300                         return (-1);
 301                 }
 302                 offset = 1;
 303                 n &= ~0x80000000;
 304         }
 305 
 306         if (n  >= 1024) {
 307                 cmn_err(CE_WARN, "%s: %s:n=0x%x Card flash not initialized\n",
 308                     unm_nic_driver_name, __FUNCTION__, n);
 309                 return (-1);
 310         }
 311 
 312         if (verbose)
 313                 cmn_err(CE_WARN, "%s: %d CRB init values found in ROM.\n",
 314                     unm_nic_driver_name, n);
 315 
 316         buf = kmem_zalloc(n * sizeof (struct crb_addr_pair), KM_SLEEP);





 317 
 318         for (i = 0; i < n; i++) {
 319                 if (rom_fast_read(adapter, 8*i + 4*offset, &val) != 0 ||
 320                     rom_fast_read(adapter, 8*i + 4*offset + 4, &addr) != 0) {
 321                         kmem_free(buf, n * sizeof (struct crb_addr_pair));
 322                         return (-1);
 323                 }
 324 
 325                 buf[i].addr = addr;
 326                 buf[i].data = val;
 327 
 328                 if (verbose)
 329                         cmn_err(CE_WARN, "%s: PCI:     0x%08x == 0x%08x\n",
 330                             unm_nic_driver_name,
 331                             (unsigned int)decode_crb_addr(
 332                             (unsigned long)addr), val);
 333         }
 334 
 335         for (i = 0; i < n; i++) {
 336                 off = decode_crb_addr((unsigned long)buf[i].addr) +