Skip to contentSkip to conversation

parport: sunbpp: fix error return code

PATCH New Sudip Mukherjee 1 participant 2 messages Jul 12, 2018 Parallel port

lore
Share & tools
lore

Sudip Mukherjee

author maintainer
#0 lore raw

PATCH 1/2 parport: sunbpp: fix error return code

From: Julia Lawall <[email protected]>

Return an error code on failure. Change leading spaces to tab on the first if.

Problem found using Coccinelle.

---
 drivers/parport/parport_sunbpp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/parport/parport_sunbpp.c +6 -2
index 01cf1c1a841a..8de329546b82 100644
@@ -286,12 +286,16 @@ static int bpp_probe(struct platform_device *op)
 
 	ops = kmemdup(&parport_sunbpp_ops, sizeof(struct parport_operations),
 		      GFP_KERNEL);
-        if (!ops)
+	if (!ops) {
+		err = -ENOMEM;
 		goto out_unmap;
+	}
 
 	dprintk(("register_port\n"));
-	if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
+	if (!(p = parport_register_port((unsigned long)base, irq, dma, ops))) {
+		err = -ENOMEM;
 		goto out_free_ops;
+	}
 
 	p->size = size;
 	p->dev = &op->dev;
Signature · 1 line
2.11.0
author maintainer
#1 lore raw

PATCH 2/2 parport: ieee1284: mark expected switch fall-throughs

From: "Gustavo A. R. Silva" <[email protected]>

In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through.

---
 drivers/parport/ieee1284.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/parport/ieee1284.c +2 -1
index 2d1a5c737c6e..f12b9da69255 100644
@@ -267,7 +267,7 @@ static void parport_ieee1284_terminate (struct parport *port)
 			port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
 		}
 
-		/* fall-though.. */
+		/* fall through */
 
 	default:
 		/* Terminate from all other modes. */
@@ -615,6 +615,7 @@ ssize_t parport_write (struct parport *port, const void *buffer, size_t len)
 	case IEEE1284_MODE_NIBBLE:
 	case IEEE1284_MODE_BYTE:
 		parport_negotiate (port, IEEE1284_MODE_COMPAT);
+		/* fall through */
 	case IEEE1284_MODE_COMPAT:
 		DPRINTK (KERN_DEBUG "%s: Using compatibility mode\n",
 			 port->name);
Signature · 1 line
2.11.0