summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-01-31 08:10:22 +0200
committerToomas Soome <tsoome@me.com>2020-04-27 20:28:42 +0300
commit52e32d3842d8ce38bd888b33fb2e2998eab03619 (patch)
treec20831fa40dcab0c3c41a552baa142693aaa274a /usr/src
parentd35ce8d71dd4f0ec672492fe393e3d5af4145a48 (diff)
downloadillumos-gate-52e32d3842d8ce38bd888b33fb2e2998eab03619.tar.gz
12578 pcf8574: NULL pointer errors
Reviewed by: Gergő Doma <domag02@gmail.com> Reviewed by: Sebastian Wiedenroth <sebastian.wiedenroth@skylime.net> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/uts/sun4u/io/i2c/clients/pcf8574.c34
-rw-r--r--usr/src/uts/sun4u/pcf8574/Makefile17
2 files changed, 18 insertions, 33 deletions
diff --git a/usr/src/uts/sun4u/io/i2c/clients/pcf8574.c b/usr/src/uts/sun4u/io/i2c/clients/pcf8574.c
index 98f01fb3dd..dfb0cc9f66 100644
--- a/usr/src/uts/sun4u/io/i2c/clients/pcf8574.c
+++ b/usr/src/uts/sun4u/io/i2c/clients/pcf8574.c
@@ -218,18 +218,19 @@ pcf8574_close(dev_t dev, int flags, int otyp, cred_t *credp)
}
static int
-pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) {
+pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte)
+{
i2c_transfer_t *i2c_tran_pointer;
int err = I2C_SUCCESS;
D1CMN_ERR((CE_WARN, "Entered the pcf8574_get routine\n"));
(void) i2c_transfer_alloc(unitp->pcf8574_hdl, &i2c_tran_pointer,
- 0, 1, I2C_SLEEP);
+ 0, 1, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
D2CMN_ERR((CE_WARN, "%s: Failed in pcf8574_get "
- "i2c_tran_pointer not allocated\n",
- unitp->pcf8574_name));
+ "i2c_tran_pointer not allocated\n",
+ unitp->pcf8574_name));
return (ENOMEM);
}
@@ -237,13 +238,13 @@ pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) {
err = i2c_transfer(unitp->pcf8574_hdl, i2c_tran_pointer);
if (err) {
D2CMN_ERR((CE_WARN, "%s: Failed in the i2c_transfer routine\n",
- unitp->pcf8574_name));
+ unitp->pcf8574_name));
i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer);
return (err);
}
D1CMN_ERR((CE_WARN, "Back from a transfer value is %x\n",
- i2c_tran_pointer->i2c_rbuf[0]));
+ i2c_tran_pointer->i2c_rbuf[0]));
*byte = i2c_tran_pointer->i2c_rbuf[0];
i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer);
@@ -251,29 +252,30 @@ pcf8574_get(struct pcf8574_unit *unitp, uchar_t *byte) {
}
static int
-pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) {
+pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte)
+{
i2c_transfer_t *i2c_tran_pointer;
int err = I2C_SUCCESS;
(void) i2c_transfer_alloc(unitp->pcf8574_hdl, &i2c_tran_pointer,
- 1, 0, I2C_SLEEP);
+ 1, 0, I2C_SLEEP);
if (i2c_tran_pointer == NULL) {
D2CMN_ERR((CE_WARN, "%s: Failed in pcf8574_set "
- "i2c_tran_pointer not allocated\n",
- unitp->pcf8574_name));
+ "i2c_tran_pointer not allocated\n",
+ unitp->pcf8574_name));
return (ENOMEM);
}
i2c_tran_pointer->i2c_flags = I2C_WR;
i2c_tran_pointer->i2c_wbuf[0] = byte;
D1CMN_ERR((CE_NOTE, "%s: contains %x\n", unitp->pcf8574_name,
- i2c_tran_pointer->i2c_wbuf[0]));
+ i2c_tran_pointer->i2c_wbuf[0]));
err = i2c_transfer(unitp->pcf8574_hdl, i2c_tran_pointer);
if (err) {
D2CMN_ERR((CE_WARN, "%s: Failed in the pcf8574_set"
- " i2c_transfer routine\n",
- unitp->pcf8574_name));
+ " i2c_transfer routine\n",
+ unitp->pcf8574_name));
i2c_transfer_free(unitp->pcf8574_hdl, i2c_tran_pointer);
return (err);
}
@@ -283,7 +285,7 @@ pcf8574_set(struct pcf8574_unit *unitp, uchar_t byte) {
static int
pcf8574_ioctl(dev_t dev, int cmd, intptr_t arg, int mode,
- cred_t *credp, int *rvalp)
+ cred_t *credp, int *rvalp)
{
_NOTE(ARGUNUSED(credp, rvalp))
@@ -294,7 +296,7 @@ pcf8574_ioctl(dev_t dev, int cmd, intptr_t arg, int mode,
i2c_port_t ioctl_port;
uchar_t byte;
- if (arg == NULL) {
+ if (arg == (intptr_t)NULL) {
D2CMN_ERR((CE_WARN, "PCF8574: ioctl: arg passed in to ioctl "
"= NULL\n"));
err = EINVAL;
@@ -509,7 +511,7 @@ pcf8574_do_attach(dev_info_t *dip)
if (ddi_create_minor_node(dip, "pcf8574", S_IFCHR, instance,
- "ddi_i2c:ioexp", NULL) == DDI_FAILURE) {
+ "ddi_i2c:ioexp", 0) == DDI_FAILURE) {
cmn_err(CE_WARN, "%s ddi_create_minor_node failed for "
"%s\n", unitp->pcf8574_name, "pcf8574");
ddi_soft_state_free(pcf8574soft_statep, instance);
diff --git a/usr/src/uts/sun4u/pcf8574/Makefile b/usr/src/uts/sun4u/pcf8574/Makefile
index c5ac0684be..6913ee45dd 100644
--- a/usr/src/uts/sun4u/pcf8574/Makefile
+++ b/usr/src/uts/sun4u/pcf8574/Makefile
@@ -22,10 +22,6 @@
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
-#
-#ident "%Z%%M% %I% %E% SMI"
-#
-
# This makefile drives the pcf8574 build.
#
# Path to the base of the uts directory tree (usually /usr/src/uts).
@@ -37,7 +33,6 @@ UTSBASE = ../..
#
MODULE = pcf8574
OBJECTS = $(PCF8574_OBJS:%=$(OBJS_DIR)/%)
-LINTS = $(PCF8574_OBJS:%.o=$(LINTS_DIR)/%.ln)
ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
#
@@ -45,18 +40,12 @@ ROOTMODULE = $(ROOT_PSM_DRV_DIR)/$(MODULE)
#
include $(UTSBASE)/sun4u/Makefile.sun4u
-#
-# lint pass one enforcement
-#
-CFLAGS += $(CCVERBOSE)
-
LDFLAGS += -dy -N misc/i2c_svc
#
# Define targets
#
ALL_TARGET = $(BINARY)
-LINT_TARGET = $(MODULE).lint
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
.KEEP_STATE:
@@ -69,12 +58,6 @@ clean: $(CLEAN_DEPS)
clobber: $(CLOBBER_DEPS)
-lint: $(LINT_DEPS)
-
-modlintlib: $(MODLINTLIB_DEPS)
-
-clean.lint: $(CLEAN_LINT_DEPS)
-
install: $(INSTALL_DEPS)
#