[PATCH 124/141] staging: unisys: Add checks for creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Don Zickus <dzickus@xxxxxxxxxx>

There was a bunch of channel creation checks before the
visorchannel_create function was called, moving some of those
checks inside.  This keeps the outside code cleaner and handles
the situation where a caller forgets to make these checks.

Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
Signed-off-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visorbus/visorchannel.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/unisys/visorbus/visorchannel.c b/drivers/staging/unisys/visorbus/visorchannel.c
index 1789f9d..6e7675e 100644
--- a/drivers/staging/unisys/visorbus/visorchannel.c
+++ b/drivers/staging/unisys/visorbus/visorchannel.c
@@ -62,6 +62,9 @@ visorchannel_create_guts(u64 physaddr, unsigned long channel_bytes,
 	int err;
 	size_t size = sizeof(struct channel_header);
 
+	if (physaddr == 0)
+		return NULL;
+
 	channel = kzalloc(sizeof(*channel), gfp);
 	if (!channel)
 		goto cleanup;
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux