diff mbox series

[1/7] mmc-utils: lsmmc: Break early in scr read

Message ID 20250310055231.304728-2-avri.altman@sandisk.com
State New
Headers show
Series mmc-utils: lsmmc: Registers value as an argument | expand

Commit Message

Avri Altman March 10, 2025, 5:52 a.m. UTC
This commit refactors the SCR case in the process_dir function to use
the bus type check instead of comparing the type string directly. This
change simplifies the logic and makes it consistent with other parts of
the code that use the bus type.

Signed-off-by: Avri Altman <avri.altman@sandisk.com>
---
 lsmmc.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/lsmmc.c b/lsmmc.c
index 7e0ea23..bc0e264 100644
--- a/lsmmc.c
+++ b/lsmmc.c
@@ -2146,15 +2146,16 @@  static int process_dir(struct config *config, enum REG_TYPE reg)
 
 		break;
 	case SCR:
-		if (!strcmp(type, "SD")) {
-			reg_content = read_file("scr");
-			if (!reg_content) {
-				fprintf(stderr, "Could not read SD card "
-					"configuration in directory '%s'.\n",
-					config->dir);
-				ret = -1;
-				goto err;
-			}
+		if (config->bus != SD)
+			break;
+
+		reg_content = read_file("scr");
+		if (!reg_content) {
+			fprintf(stderr, "Could not read SD card "
+				"configuration in directory '%s'.\n",
+				config->dir);
+			ret = -1;
+			goto err;
 		}
 
 		print_sd_scr(config, reg_content);