summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-01-31 14:43:19 +0200
committerToomas Soome <tsoome@me.com>2020-05-10 10:39:43 +0300
commitc5fab18ea427d8368421383466fe138ed00ed68d (patch)
tree9497c8cadc535c312031b5c9d2ed725d2f1928af
parent44da0df0d621255604c6a72b29e72219d50a76d6 (diff)
downloadillumos-joyent-c5fab18ea427d8368421383466fe138ed00ed68d.tar.gz
12628 chicago: smatch and NULL pointer errors
Reviewed by: C Fraire <cfraire@me.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com>
-rw-r--r--usr/src/uts/sun4/io/fpc/fpc-kstats.c19
-rw-r--r--usr/src/uts/sun4u/chicago/Makefile28
-rw-r--r--usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c5
-rw-r--r--usr/src/uts/sun4u/chicago/os/chicago.c4
4 files changed, 11 insertions, 45 deletions
diff --git a/usr/src/uts/sun4/io/fpc/fpc-kstats.c b/usr/src/uts/sun4/io/fpc/fpc-kstats.c
index 38a390031b..89949e9927 100644
--- a/usr/src/uts/sun4/io/fpc/fpc-kstats.c
+++ b/usr/src/uts/sun4/io/fpc/fpc-kstats.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#include <sys/sunddi.h>
#include <sys/sunndi.h>
@@ -281,7 +279,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst)
(void) strncpy(dev_name, "tlu", sizeof (dev_name));
num_events = sizeof (fire_tlu_events) / sizeof (fi_kev_mask_t);
num_events2 = sizeof (fire_tlu2_events) /
- sizeof (fi_kev_mask_t);
+ sizeof (fi_kev_mask_t);
fire_events = fire_tlu_events;
fire_events2 = fire_tlu2_events;
num_cntrs = NUM_TLU_COUNTERS;
@@ -297,8 +295,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst)
}
for (i = 0; i < num_inst; i++) {
- ksinfop = (fi_ksinfo_t *)kmem_zalloc(sizeof (fi_ksinfo_t),
- KM_SLEEP);
+ ksinfop = kmem_zalloc(sizeof (fi_ksinfo_t), KM_SLEEP);
ksinfop->pic_num_events = num_events;
ksinfop->pic_reg_group = reg_group;
@@ -361,7 +358,7 @@ fpc_dev_kstat(fire_perfcnt_t reg_group, uint8_t num_inst)
/* create counter kstats */
ksinfop->cntr_ksp = fpc_create_cntr_kstat(dev_name, i,
- fpc_cntr_kstat_update, ksinfop, num_cntrs);
+ fpc_cntr_kstat_update, ksinfop, num_cntrs);
if (ksinfop->cntr_ksp == NULL)
goto err;
@@ -384,7 +381,7 @@ fpc_create_name_kstat(char *name, fi_ksinfo_t *pp, fi_kev_mask_t *ev,
for (i = base; i < (base + num_cntrs); i++) {
pp->pic_name_ksp[i] = fpc_create_picN_kstat(name, i,
- pp->pic_sel_shift[i], pp->pic_num_events, ev);
+ pp->pic_sel_shift[i], pp->pic_num_events, ev);
if (pp->pic_name_ksp[i] == NULL)
return (FAILURE);
@@ -408,7 +405,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev,
(void) snprintf(pic_name, sizeof (pic_name), "pic%d", pic);
if ((picN_ksp = kstat_create(mod_name, 0, pic_name,
- "bus", KSTAT_TYPE_NAMED, num_ev, NULL)) == NULL) {
+ "bus", KSTAT_TYPE_NAMED, num_ev, 0)) == NULL) {
cmn_err(CE_WARN, "%s %s : kstat create failed",
mod_name, pic_name);
return (NULL);
@@ -423,7 +420,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev,
*/
for (event = 0; event < num_ev - 1; event++) {
pic_named_data[event].value.ui64 =
- (ev_array[event].pcr_mask << pic_sel_shift);
+ (ev_array[event].pcr_mask << pic_sel_shift);
kstat_named_init(&pic_named_data[event],
ev_array[event].event_name, KSTAT_DATA_UINT64);
@@ -433,7 +430,7 @@ fpc_create_picN_kstat(char *mod_name, int pic, int pic_sel_shift, int num_ev,
* add the clear_pic entry
*/
pic_named_data[event].value.ui64 =
- (uint64_t)~(ev_array[event].pcr_mask << pic_sel_shift);
+ (uint64_t)~(ev_array[event].pcr_mask << pic_sel_shift);
kstat_named_init(&pic_named_data[event], ev_array[event].event_name,
KSTAT_DATA_UINT64);
@@ -471,7 +468,7 @@ fpc_create_cntr_kstat(char *name, int instance, int (*update)(kstat_t *, int),
if ((counters_ksp = kstat_create(name, instance, "counters", "bus",
KSTAT_TYPE_NAMED, num_pics + 1, KSTAT_FLAG_WRITABLE)) == NULL) {
cmn_err(CE_WARN, "kstat_create for %s%d failed",
- name, instance);
+ name, instance);
return (NULL);
}
diff --git a/usr/src/uts/sun4u/chicago/Makefile b/usr/src/uts/sun4u/chicago/Makefile
index 683b077445..8795f4f948 100644
--- a/usr/src/uts/sun4u/chicago/Makefile
+++ b/usr/src/uts/sun4u/chicago/Makefile
@@ -22,8 +22,6 @@
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
# uts/sun4u/chicago/Makefile
#
# This makefile drives the production of the sun4u chicago platform
@@ -48,12 +46,8 @@ install := TARGET= install
install_h := TARGET= install_h
clean := TARGET= clean
clobber := TARGET= clobber
-lint := TARGET= lint
-lintlib := TARGET= lintlib
-modlintlib := TARGET= modlintlib
modlist := TARGET= modlist
modlist := NO_STATE= -K $$MODSTATE$$$$
-clean.lint := TARGET= clean.lint
check := TARGET= check
#
@@ -61,9 +55,7 @@ check := TARGET= check
#
.KEEP_STATE:
-def all clean clean.lint clobber modlist: $(CHICAGO_KMODS)
-
-modlintlib: $(CHICAGO_KMODS)
+def all clean clobber modlist: $(CHICAGO_KMODS)
install: $(ROOT_CHICAGO_DIR) \
$(USR_CHICAGO_DIR) \
@@ -75,24 +67,6 @@ install: $(ROOT_CHICAGO_DIR) \
check install_h:
-lint: modlintlib
-
-#
-# The 'lint.platmod' target lints the chicago platform module against the sun4u
-# kernel. This ends up doing all the kernel cross-checks, so it takes a couple
-# of minutes. Due to the low ROI, it's not run by default, but it's a good
-# idea to run this if you change os/chicago.c.
-#
-LINT_LIBS = $(LINT_LIB) \
- -L$(CHICAGO_LINT_LIB_DIR) \
- -L$(LINT_LIB_DIR) $(LINT_KMODS:%=-l%) \
- $(CLOSED_LINT_KMODS:%=-l%) \
- -L$(SPARC_LIB_DIR) $(SPARC_LINTS:%=-l%)
-
-lint.platmod: modlintlib
- @-$(ECHO) "\nChicago Platform-dependent module: global crosschecks:"
- @-$(LINT) $(LINTFLAGS) $(LINT_LIBS) 2>&1 | $(LGREP.2)
-
$(CHICAGO_KMODS): FRC
@cd $@; pwd; $(MAKE) $(NO_STATE) $(TARGET)
diff --git a/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c b/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c
index 850501397a..aa96f19079 100644
--- a/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c
+++ b/usr/src/uts/sun4u/chicago/io/fpc/fpc-impl-4u.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/file.h>
#include <sys/sunndi.h>
#include <sys/sunddi.h>
@@ -189,8 +187,7 @@ bad_regs_length:
if (regs_p)
kmem_free(regs_p, regs_length);
bad_regs_p:
- if (platform_specific_data)
- kmem_free(platform_specific_data, sizeof (fire4u_specific_t));
+ kmem_free(platform_specific_data, sizeof (fire4u_specific_t));
if (nodename)
kmem_free(nodename, nodename_size);
diff --git a/usr/src/uts/sun4u/chicago/os/chicago.c b/usr/src/uts/sun4u/chicago/os/chicago.c
index f1cfc84bfe..205e940eba 100644
--- a/usr/src/uts/sun4u/chicago/os/chicago.c
+++ b/usr/src/uts/sun4u/chicago/os/chicago.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/sysmacros.h>
@@ -53,7 +51,7 @@ static void get_ebus_rtc_vaddr(void);
void
startup_platform(void)
{
- mutex_init(&chicago_mi2cv_mutex, NULL, NULL, NULL);
+ mutex_init(&chicago_mi2cv_mutex, NULL, MUTEX_ADAPTIVE, NULL);
}
int