diff mbox series

[OpenWrt-Devel,fstools,1/4] block: fix formatting & indent in the mount_device()

Message ID 20181130130923.4678-1-zajec5@gmail.com
State Accepted
Delegated to: Rafał Miłecki
Headers show
Series [OpenWrt-Devel,fstools,1/4] block: fix formatting & indent in the mount_device() | expand

Commit Message

Rafał Miłecki Nov. 30, 2018, 1:09 p.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

There was some misformatted code that seemed like switch block having an
else block. This improves code readability.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 block.c | 34 ++++++++++++++++++----------------
 1 file changed, 18 insertions(+), 16 deletions(-)

Comments

Michael Heimpold Dec. 1, 2018, 12:32 p.m. UTC | #1
Hi,

Am Freitag, 30. November 2018, 14:09:20 CET schrieb Rafał Miłecki:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> There was some misformatted code that seemed like switch block having an
> else block. This improves code readability.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  block.c | 34 ++++++++++++++++++----------------
>  1 file changed, 18 insertions(+), 16 deletions(-)
> 
> diff --git a/block.c b/block.c
> index b01a633..d87251d 100644
> --- a/block.c
> +++ b/block.c
> @@ -1021,22 +1021,24 @@ static int mount_device(struct probe_info *pr, int
> type) if (m && m->extroot)
>  		return -1;
> 
> -	if (m) switch (type) {
> -	case TYPE_HOTPLUG:
> -		blockd_notify(device, m, pr);
> -		if (m->autofs)
> -			return 0;
> -		if (!auto_mount)
> -			return -1;
> -		break;
> -	case TYPE_AUTOFS:
> -		if (!m->autofs)
> -			return -1;
> -		break;
> -	case TYPE_DEV:
> -		if (m->autofs)
> -			return -1;
> -		break;
> +	if (m) {
> +		switch (type) {
> +		case TYPE_HOTPLUG:
> +			blockd_notify(device, m, pr);
> +			if (m->autofs)
> +				return 0;
> +			if (!auto_mount)
> +				return -1;
> +			break;
> +		case TYPE_AUTOFS:
> +			if (!m->autofs)
> +				return -1;
> +			break;
> +		case TYPE_DEV:
> +			if (m->autofs)
> +				return -1;
> +			break;
> +		}
>  	} else if (type == TYPE_HOTPLUG) {
>  		blockd_notify(device, NULL, pr);
>  	}

LGTM, so feel free to add for the whole series:

Reviewed-by: Michael Heimpold <mhei@heimpold.de>
diff mbox series

Patch

diff --git a/block.c b/block.c
index b01a633..d87251d 100644
--- a/block.c
+++ b/block.c
@@ -1021,22 +1021,24 @@  static int mount_device(struct probe_info *pr, int type)
 	if (m && m->extroot)
 		return -1;
 
-	if (m) switch (type) {
-	case TYPE_HOTPLUG:
-		blockd_notify(device, m, pr);
-		if (m->autofs)
-			return 0;
-		if (!auto_mount)
-			return -1;
-		break;
-	case TYPE_AUTOFS:
-		if (!m->autofs)
-			return -1;
-		break;
-	case TYPE_DEV:
-		if (m->autofs)
-			return -1;
-		break;
+	if (m) {
+		switch (type) {
+		case TYPE_HOTPLUG:
+			blockd_notify(device, m, pr);
+			if (m->autofs)
+				return 0;
+			if (!auto_mount)
+				return -1;
+			break;
+		case TYPE_AUTOFS:
+			if (!m->autofs)
+				return -1;
+			break;
+		case TYPE_DEV:
+			if (m->autofs)
+				return -1;
+			break;
+		}
 	} else if (type == TYPE_HOTPLUG) {
 		blockd_notify(device, NULL, pr);
 	}