From cea398849eee4e2bf16ce0a52eb94dc196a79d31 Mon Sep 17 00:00:00 2001
From: Scott Lahteine <github@thinkyhead.com>
Date: Sat, 7 Apr 2018 21:25:39 -0500
Subject: [PATCH] Tweak to gcode_line_error/return

---
 Marlin/src/gcode/queue.cpp | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp
index 8ad6d842fc..169aa3add5 100644
--- a/Marlin/src/gcode/queue.cpp
+++ b/Marlin/src/gcode/queue.cpp
@@ -320,32 +320,24 @@ inline void get_serial_commands() {
 
           gcode_N = strtol(npos + 1, NULL, 10);
 
-          if (gcode_N != gcode_LastN + 1 && !M110) {
-            gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
-            return;
-          }
+          if (gcode_N != gcode_LastN + 1 && !M110)
+            return gcode_line_error(PSTR(MSG_ERR_LINE_NO), i);
 
           char *apos = strrchr(command, '*');
           if (apos) {
             uint8_t checksum = 0, count = uint8_t(apos - command);
             while (count) checksum ^= command[--count];
-            if (strtol(apos + 1, NULL, 10) != checksum) {
-              gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
-              return;
-            }
-          }
-          else {
-            gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
-            return;
+            if (strtol(apos + 1, NULL, 10) != checksum)
+              return gcode_line_error(PSTR(MSG_ERR_CHECKSUM_MISMATCH), i);
           }
+          else
+            return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
 
           gcode_LastN = gcode_N;
         }
         #if ENABLED(SDSUPPORT)
-          else if (card.saving) {
-            gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
-            return;
-          }
+          else if (card.saving)
+            return gcode_line_error(PSTR(MSG_ERR_NO_CHECKSUM), i);
         #endif
 
         // Movement commands alert when stopped
-- 
GitLab