summaryrefslogtreecommitdiff
path: root/usr
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-01-31 09:47:58 +0200
committerToomas Soome <tsoome@me.com>2020-05-15 14:06:37 +0300
commit836be2fe28b6fc20176de322440ef4bb1a5f37dd (patch)
tree2549e80faa24a8fb305ee5458dba3157b1bdb73a /usr
parent4a6e21349395bc68ce9ec2839d99f74b079861b5 (diff)
downloadillumos-joyent-836be2fe28b6fc20176de322440ef4bb1a5f37dd.tar.gz
12726 sbbc: smatch and NULL pointer errors
Reviewed by: C Fraire <cfraire@me.com> Reviewed by: Robert Mustacchi <rm@fingolfin.org> Approved by: Joshua M. Clulow <josh@sysmgr.org>
Diffstat (limited to 'usr')
-rw-r--r--usr/src/uts/sun4u/io/sbbc.c36
-rw-r--r--usr/src/uts/sun4u/sbbc/Makefile21
2 files changed, 19 insertions, 38 deletions
diff --git a/usr/src/uts/sun4u/io/sbbc.c b/usr/src/uts/sun4u/io/sbbc.c
index 615ea8549e..10117ae4dd 100644
--- a/usr/src/uts/sun4u/io/sbbc.c
+++ b/usr/src/uts/sun4u/io/sbbc.c
@@ -172,15 +172,15 @@ static struct bus_ops sbbc_bus_ops = {
0,
0,
0,
- NULL, /* (*bus_map_fault)() */
+ NULL, /* (*bus_map_fault)() */
ddi_no_dma_map,
ddi_no_dma_allochdl,
- ddi_no_dma_freehdl, /* (*bus_dma_freehdl)() */
- ddi_no_dma_bindhdl, /* (*bus_dma_bindhdl)() */
- ddi_no_dma_unbindhdl, /* (*bus_dma_unbindhdl)() */
- ddi_no_dma_flush, /* (*bus_dma_flush)() */
- ddi_no_dma_win, /* (*bus_dma_win)() */
- ddi_no_dma_mctl, /* (*bus_dma_ctl)() */
+ ddi_no_dma_freehdl, /* (*bus_dma_freehdl)() */
+ ddi_no_dma_bindhdl, /* (*bus_dma_bindhdl)() */
+ ddi_no_dma_unbindhdl, /* (*bus_dma_unbindhdl)() */
+ ddi_no_dma_flush, /* (*bus_dma_flush)() */
+ ddi_no_dma_win, /* (*bus_dma_win)() */
+ ddi_no_dma_mctl, /* (*bus_dma_ctl)() */
sbbc_ctlops,
ddi_bus_prop_op,
0, /* (*bus_get_eventcookie)(); */
@@ -425,7 +425,7 @@ sbbc_attach(dev_info_t *dip, ddi_attach_cmd_t cmd)
(void) sprintf(name, "sbbc%d", instance);
if (ddi_create_minor_node(dip, name, S_IFCHR, instance, NULL,
- NULL) == DDI_FAILURE) {
+ 0) == DDI_FAILURE) {
ddi_remove_minor_node(dip, NULL);
goto failed;
}
@@ -510,7 +510,7 @@ sbbc_detach(dev_info_t *dip, ddi_detach_cmd_t cmd)
*/
static int
sbbc_busmap(dev_info_t *dip, dev_info_t *rdip, ddi_map_req_t *mp,
- off_t off, off_t len, caddr_t *addrp)
+ off_t off, off_t len, caddr_t *addrp)
{
struct sbbcsoft *sbbcsoftp;
sbbc_child_regspec_t *child_rp, *child_regs;
@@ -690,7 +690,7 @@ sbbc_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op,
childintr->status = SBBC_INTR_STATE_DISABLE;
for (i = 0; i < MAX_SBBC_DEVICES; i++) {
- if (sbbcsoftp->child_intr[i] == 0) {
+ if (sbbcsoftp->child_intr[i] == NULL) {
sbbcsoftp->child_intr[i] = childintr;
break;
}
@@ -705,7 +705,8 @@ sbbc_add_intr_impl(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op,
cmn_err(CE_WARN, "sbbc%d: failed to add intr for %s",
instance, ddi_get_name(rdip));
kmem_free(childintr, sizeof (struct sbbc_child_intr));
- sbbcsoftp->child_intr[i] = NULL;
+ if (i < MAX_SBBC_DEVICES)
+ sbbcsoftp->child_intr[i] = NULL;
}
/*
@@ -817,7 +818,7 @@ sbbc_update_intr_state(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op,
*/
static int
sbbc_ctlops(dev_info_t *dip, dev_info_t *rdip, ddi_ctl_enum_t op,
- void *arg, void *result)
+ void *arg, void *result)
{
sbbc_child_regspec_t *child_rp;
int i, n;
@@ -1121,7 +1122,7 @@ sbbc_close(dev_t dev, int flag, int otype, cred_t *credp)
/*ARGSUSED2*/
static int
sbbc_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp,
- int *rvalp)
+ int *rvalp)
{
struct sbbcsoft *sbbcsoftp;
@@ -1144,7 +1145,7 @@ sbbc_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp,
return (EINVAL);
}
- if (arg == NULL) {
+ if (arg == (intptr_t)NULL) {
return (ENXIO);
}
@@ -1184,7 +1185,7 @@ sbbc_ioctl(dev_t dev, int cmd, intptr_t arg, int mode, cred_t *credp,
return (EINVAL);
}
- if (arg == NULL) {
+ if (arg == (intptr_t)NULL) {
return (ENXIO);
}
@@ -1372,7 +1373,8 @@ sbbc_intr_wrapper(caddr_t arg)
* used to crash the system.
*/
static int
-sbbc_offset_valid(uint32_t offset) {
+sbbc_offset_valid(uint32_t offset)
+{
/*
* Check for proper alignment first.
*/
@@ -1415,7 +1417,7 @@ sbbc_offset_valid(uint32_t offset) {
#ifdef DEBUG
void
sbbc_dbg(uint32_t flag, dev_info_t *dip, char *fmt,
- uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5)
+ uintptr_t a1, uintptr_t a2, uintptr_t a3, uintptr_t a4, uintptr_t a5)
{
char *s = NULL;
diff --git a/usr/src/uts/sun4u/sbbc/Makefile b/usr/src/uts/sun4u/sbbc/Makefile
index fab5fa1d4b..69d3b24876 100644
--- a/usr/src/uts/sun4u/sbbc/Makefile
+++ b/usr/src/uts/sun4u/sbbc/Makefile
@@ -40,7 +40,6 @@ UTSBASE = ../..
#
MODULE = sbbc
OBJECTS = $(SBBC_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(SBBC_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
#
@@ -52,30 +51,16 @@ include $(UTSBASE)/sun4u/Makefile.sun4u
# Define targets
#
ALL_TARGET = $(BINARY)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
# Turn this on once compiler understands v9 in it's backend
#INLINES += $(UTSBASE)/sun4u/io/sbbc.il
#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
-
-#
# Turn on doubleword alignment for 64 bit registers
#
CFLAGS += -dalign
-#
-# For now, disable these lint checks; maintainers should endeavor
-# to investigate and remove these for maximum lint coverage.
-# Please do not carry these forward to new Makefiles.
-#
-LINTTAGS += -erroff=E_BAD_PTR_CAST_ALIGN
-LINTTAGS += -erroff=E_ASSIGN_NARROW_CONV
-
CERRWARN += -_gcc=-Wno-switch
#
@@ -91,12 +76,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#