[][Fix switch converity issue]

[Description]
Fix switch converity issue.
1: Check the error status of function call fgets.
2: Fix the file so that both jaguar dsa and gsw recognize embedded switch.

[Release-log]
N/A

Change-Id: Icbefcecf694f4ca1f18a39d2bf0dd7524c3f3de7
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6329527
diff --git a/feed/switch/src/switch_753x.c b/feed/switch/src/switch_753x.c
index 1730235..2637ed5 100644
--- a/feed/switch/src/switch_753x.c
+++ b/feed/switch/src/switch_753x.c
@@ -240,7 +240,7 @@
 
 static int get_chip_name()
 {
-	unsigned int temp;
+	int temp;
 	FILE *fp = NULL;
 	char buff[255];
 
@@ -256,14 +256,14 @@
 		return temp;
 
 	/*judge jaguar embedded switch*/
-	fp = fopen("/sys/bus/platform/devices/15020000.gsw/of_node/mediatek,model", "r");
+	fp = fopen("/proc/device-tree/compatible", "r");
 	if (fp != NULL) {
-		fgets(buff, 255, (FILE *)fp);
-		fclose(fp);
-		if (!strcmp(buff, "mediatek,mt7988")) {
+		temp = -1;
+		if (fgets(buff, 255, (FILE *)fp) && strstr(buff, "mt7988"))
 			temp = 0x7988;
-			return temp;
-		}
+
+		fclose(fp);
+		return temp;
 	}
 
 	return -1;