public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/2] staging: sb105x: move dereference under IS_ERR() check
@ 2013-01-09  7:10 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2013-01-09  7:10 UTC (permalink / raw)
  To: kernel-janitors

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

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Only needed in linux-next.

diff --git a/drivers/staging/sb105x/sb_pci_mp.c b/drivers/staging/sb105x/sb_pci_mp.c
index 131afd0c..c34ebff 100644
--- a/drivers/staging/sb105x/sb_pci_mp.c
+++ b/drivers/staging/sb105x/sb_pci_mp.c
@@ -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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-09  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-09  7:10 [patch 1/2] staging: sb105x: move dereference under IS_ERR() check Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox