Skip to contentSkip to conversation

staging: sb105x: move dereference under IS_ERR() check

PATCH In review Dan Carpenter 1 participant 1 message Jan 9, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 staging: sb105x: move dereference under IS_ERR() check

Avoid dereverencing the ERR_PTR() by shifting the dereference down a couple lines.

---
Only needed in linux-next.

drivers/staging/sb105x/sb_pci_mp.c +2 -2
index 131afd0c..c34ebff 100644
@@ -1563,13 +1563,13 @@ static int mp_open(struct tty_struct *tty, struct file *filp)
 
 	state = uart_get(drv, line);
 
-	mtpt  = (struct mp_port *)state->port;
-
 	if (IS_ERR(state)) {
 		retval = PTR_ERR(state);
 		goto fail;
 	}
 
+	mtpt  = (struct mp_port *)state->port;
+
 	tty->driver_data = state;
 	tty->low_latency = (state->port->flags & UPF_LOW_LATENCY) ? 1 : 0;
 	tty->alt_speed = 0;