Print this page
6659 nvlist_free(NULL) is a no-op
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/avs/ns/nsctl/nsc_trap.c
+++ new/usr/src/uts/common/avs/ns/nsctl/nsc_trap.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
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 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 */
25 25
26 26 #include <sys/ddi.h>
27 27 #include <sys/sunddi.h>
28 28
29 29 #ifdef DS_DDICT
30 30 #include "../contract.h"
31 31 #endif
32 32
33 33 #define SVE_STE_CLASS "SVE_STE"
34 34 #define SVE_II_CLASS "SVE_II"
35 35 #define SVE_CACHE_CLASS "SVE_CACHE"
36 36
37 37 void
38 38 nsc_do_sysevent(char *driver_name, char *trap_messages, int errorno,
39 39 int alertlevel, char *component, dev_info_t *info_dip)
40 40 {
41 41 #if !defined(DS_DDICT) && !defined(_SunOS_5_6) && \
42 42 !defined(_SunOS_5_7) && !defined(_SunOS_5_8)
43 43
44 44 nvlist_t *attr_list;
45 45 int rc;
46 46
47 47 attr_list = NULL;
48 48 rc = nvlist_alloc(&attr_list, NV_UNIQUE_NAME_TYPE, KM_SLEEP);
49 49 if (rc != 0) {
50 50 goto out;
51 51 }
52 52 rc = nvlist_add_int32(attr_list, "alertlevel", alertlevel);
53 53 if (rc != 0) {
54 54 goto out;
55 55 }
56 56 rc = nvlist_add_string(attr_list, "messagevalue", trap_messages);
57 57 if (rc != 0) {
58 58 goto out;
59 59 }
60 60 rc = nvlist_add_int32(attr_list, "errorno", errorno);
61 61 if (rc != 0) {
62 62 goto out;
63 63 }
↓ open down ↓ |
63 lines elided |
↑ open up ↑ |
64 64 if (strcmp(driver_name, "sdbc") == 0)
65 65 rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
66 66 SVE_CACHE_CLASS, component, attr_list, NULL, DDI_SLEEP);
67 67 else if (strcmp(driver_name, "ste") == 0)
68 68 rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
69 69 SVE_STE_CLASS, component, attr_list, NULL, DDI_SLEEP);
70 70 else if (strcmp(driver_name, "ii") == 0)
71 71 rc = ddi_log_sysevent(info_dip, DDI_VENDOR_SUNW,
72 72 SVE_II_CLASS, component, attr_list, NULL, DDI_SLEEP);
73 73 out:
74 - if (attr_list)
75 - nvlist_free(attr_list);
74 + nvlist_free(attr_list);
76 75
77 76 if (rc != 0) {
78 77 cmn_err(CE_WARN, "!%s: unable to log sysevent %d:%s and %d",
79 78 driver_name, errorno, trap_messages, alertlevel);
80 79 }
81 80 #endif /* which O/S? */
82 81 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX