--- record-id: MISRA-REC-001 projekt: demo-epb datum: 2026-05-11 status: Approved --- # MISRA Deviation Record MISRA-REC-001 | Feld | Wert | |-------------------|---------------------------------------------| | Record-ID | MISRA-REC-001 | | Datum | 2026-05-11 | | Datei | `src/apply_controller.c` | | Funktion | `apply_ctrl_step_50ms` | | Zeile | 64 | | Standard | MISRA C:2012 | | Regel | Rule 15.5 (Advisory) — "A function should have a single point of exit" | | ASIL | D | | Status | Approved | --- ## 1. Code-Ausschnitt ```c void apply_ctrl_step_50ms(const ApplyInputs* in) { if (in == NULL) { s_ctx.last_error = EPB_EINVAL; return; /* <-- frueher Exit */ } ... } ``` ## 2. Begruendung NULL-Pointer-Check als frueher Exit-Punkt verbessert die Lesbarkeit deutlich gegenueber einer geschachtelten Variante mit einem einzigen `return` am Ende. MISRA Rule 15.5 ist **Advisory**, nicht **Required**. Der frueh-Exit hat eine klar definierte Semantik (Input-Validierung) und beeintraechtigt nicht die Verifizierbarkeit; im Gegenteil, der separate Pfad ist im Unit-Test `test_null_input` eindeutig abgedeckt. ## 3. Alternative geprueft Variante mit einzigem Exit: ```c void apply_ctrl_step_50ms(const ApplyInputs* in) { if (in == NULL) { s_ctx.last_error = EPB_EINVAL; } else { /* gesamte Step-Logik in else-Branch geschachtelt */ ... } } ``` Verworfen, weil die zusaetzliche Schachtelung die State-Machine schwerer lesbar macht und keine Funktionsaequivalenz mit der frueh-Exit-Variante gewinnt. ## 4. Auswirkung auf Sicherheit Keine. Frueher Exit ist deterministisch und im Unit-Test abgedeckt. ## 5. Freigabe | Rolle | Name | Datum | Signatur | |-----------------|------------------|-------------|----------| | Technical Lead | Stefan Lohmaier | 2026-05-11 | (Demo) | | Safety Manager | (im Realprojekt) | 2026-05-11 | (Demo) | ## 6. Geltungsbereich Nur fuer diese eine Code-Stelle. Andere Stellen mit frueh-Exit benoetigen separate Records.