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/i86pc/io/gfx_private/gfxp_pci.c
          +++ new/usr/src/uts/i86pc/io/gfx_private/gfxp_pci.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * fields enclosed by brackets "[]" replaced with your own identifying
  18   18   * information: Portions Copyright [yyyy] [name of copyright owner]
  19   19   *
  20   20   * CDDL HEADER END
  21   21   */
  22   22  /*
  23   23   * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28      -
  29   27  #include <sys/debug.h>
  30   28  #include <sys/types.h>
  31   29  #include <sys/param.h>
  32   30  #include <sys/time.h>
  33   31  #include <sys/buf.h>
  34   32  #include <sys/errno.h>
  35   33  #include <sys/systm.h>
  36   34  #include <sys/conf.h>
  37   35  #include <sys/signal.h>
  38   36  #include <sys/file.h>
↓ open down ↓ 118 lines elided ↑ open up ↑
 157  155  {
 158  156          dev_info_t      *dip;
 159  157          gfxp_pci_bsf_t  *pci_bsf;
 160  158  
 161  159          /*
 162  160           * Find a PCI device based on its address, and return a unique handle
 163  161           * to be used in subsequent calls to read from or write to the config
 164  162           * space of this device.
 165  163           */
 166  164  
 167      -        if ((pci_bsf = kmem_zalloc(sizeof (gfxp_pci_bsf_t), KM_SLEEP))
 168      -                        == NULL) {
 169      -                return (NULL);
 170      -        }
      165 +        pci_bsf = kmem_zalloc(sizeof (gfxp_pci_bsf_t), KM_SLEEP);
 171  166  
 172  167          pci_bsf->bus = bus;
 173  168          pci_bsf->slot = slot;
 174  169          pci_bsf->function = function;
 175  170  
 176  171          ddi_walk_devs(ddi_root_node(), gfxp_pci_find_bsf, pci_bsf);
 177  172  
 178  173          if (pci_bsf->found) {
 179  174                  dip = pci_bsf->dip;
 180  175  
↓ open down ↓ 142 lines elided ↑ open up ↑
 323  318  int
 324  319  gfxp_pci_device_present(uint16_t vendor, uint16_t device)
 325  320  {
 326  321          gfxp_pci_bsf_t  *pci_bsf;
 327  322          int             rv;
 328  323  
 329  324          /*
 330  325           * Find a PCI device based on its device and vendor id.
 331  326           */
 332  327  
 333      -        if ((pci_bsf = kmem_zalloc(sizeof (gfxp_pci_bsf_t), KM_SLEEP)) == NULL)
 334      -            return (0);
      328 +        pci_bsf = kmem_zalloc(sizeof (gfxp_pci_bsf_t), KM_SLEEP);
 335  329  
 336  330          pci_bsf->vendor = vendor;
 337  331          pci_bsf->device = device;
 338  332          ddi_walk_devs(ddi_root_node(), gfxp_pci_find_vd, pci_bsf);
 339  333  
 340  334          if (pci_bsf->found) {
 341  335                  rv = 1;
 342  336          } else {
 343  337                  rv = 0;
 344  338          }
 345  339  
 346  340          kmem_free(pci_bsf, sizeof (gfxp_pci_bsf_t));
 347  341  
 348  342          return (rv);
 349  343  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX