Re: [PATCH 2/8] staging: vchiq_core: Properly log dev_err()

From: Umang Jain
Date: Fri Oct 11 2024 - 06:48:27 EST


Hi Stefan

On 11/10/24 4:15 pm, Stefan Wahren wrote:
Hi Umang,

[add Raspberry Pi guys to the loop]

Am 11.10.24 um 09:22 schrieb Umang Jain:
Properly log a dev_err() message when the msgid is not of
VCHIQ_MSG_PADDING type. Drop 'oldmsgid' scoped variable and improve
on the error string as well.

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
  .../vc04_services/interface/vchiq_arm/vchiq_core.c    | 11 ++++-------
  1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index e9b60dd8d419..1dca676186b6 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -1188,13 +1188,10 @@ queue_message_sync(struct vchiq_state *state, struct vchiq_service *service,
      header = (struct vchiq_header *)SLOT_DATA_FROM_INDEX(state,
          local->slot_sync);

-    {
-        int oldmsgid = header->msgid;
-
-        if (oldmsgid != VCHIQ_MSGID_PADDING)
-            dev_err(state->dev, "core: %d: qms - msgid %x, not PADDING\n",
-                state->id, oldmsgid);
-    }
+    if (header->msgid != VCHIQ_MSGID_PADDING)
+        dev_err(state->dev,
+            "core: %d: qms - msgid %x, is not a PADDING message\n",
+            state->id, header->msgid);
I'm fine with this change, but the behavior looks strange to me.

Either this is a real error, I would expect the function would return
with something like EINVAL here or this should be a warning?

Sorry, no idea what's correct here.

indeed, I'll check the code path and see how it is used.

However, I will propose the change (if any) on top of this series/patch. Since it would be functional change ... so need to document it appropriately.


Best regards

      dev_dbg(state->dev, "sync: %d: qms %s@%pK,%x (%d->%d)\n",
          state->id, msg_type_str(VCHIQ_MSG_TYPE(msgid)), header, size,