Print this page
10087 atge_attach() doesn't need to check for kmem_zalloc() success

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/atge/atge_main.c
          +++ new/usr/src/uts/common/io/atge/atge_main.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2012 Gary Mills
  24   24   *
  25   25   * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
       26 + *
       27 + * Copyright (c) 2018, Joyent, Inc.
  26   28   */
  27   29  /*
  28   30   * Copyright (c) 2009, Pyun YongHyeon <yongari@FreeBSD.org>
  29   31   * All rights reserved.
  30   32   *
  31   33   * Redistribution and use in source and binary forms, with or without
  32   34   * modification, are permitted provided that the following conditions
  33   35   * are met:
  34   36   * 1. Redistributions of source code must retain the above copyright
  35   37   *    notice unmodified, this list of conditions, and the following
↓ open down ↓ 1309 lines elided ↑ open up ↑
1345 1347          atge_free_dma(atgep);
1346 1348          mutex_destroy(&atgep->atge_intr_lock);
1347 1349          mutex_destroy(&atgep->atge_tx_lock);
1348 1350          mutex_destroy(&atgep->atge_rx_lock);
1349 1351          atge_remove_intr(atgep);
1350 1352  fail3:
1351 1353          ddi_regs_map_free(&atgep->atge_io_handle);
1352 1354  fail2:
1353 1355          pci_config_teardown(&atgep->atge_conf_handle);
1354 1356  fail1:
1355      -        if (atgep)
1356      -                kmem_free(atgep, sizeof (atge_t));
1357      -
     1357 +        kmem_free(atgep, sizeof (atge_t));
1358 1358          return (DDI_FAILURE);
1359 1359  }
1360 1360  
1361 1361  static int
1362 1362  atge_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
1363 1363  {
1364 1364          atge_t  *atgep;
1365 1365  
1366 1366          atgep = ddi_get_driver_private(dip);
1367 1367          if (atgep == NULL) {
↓ open down ↓ 1579 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX