Skip to contentSkip to conversation

staging: comedi: cb_pcidas: check for failure of subdev_8255_init

PATCH In review H Hartley Sweeten 1 participant 1 message Jun 27, 2012 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 24/36 staging: comedi: cb_pcidas: check for failure of subdev_8255_init

It's possible for subdev_8255_init() to fail due to its kzalloc(). Make sure to check for this failure and pass on the error code.

Cc Ian Abbott <[email protected]>
Cc Frank Mori Hess <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/cb_pcidas.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/staging/comedi/drivers/cb_pcidas.c +4 -1
index 9379d25..a033071 100644
@@ -1640,7 +1640,10 @@ static int cb_pcidas_attach(struct comedi_device *dev,
 
 	/* 8255 */
 	s = dev->subdevices + 2;
-	subdev_8255_init(dev, s, NULL, devpriv->pacer_counter_dio + DIO_8255);
+	ret = subdev_8255_init(dev, s, NULL,
+			       devpriv->pacer_counter_dio + DIO_8255);
+	if (ret)
+		return ret;
 
 	/*  serial EEPROM, */
 	s = dev->subdevices + 3;
Signature · 1 line
1.7.11