ASoC: SOF: ipc4-topology: Clarify bind failure caused by missing fw_module
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>
Mon, 3 Apr 2023 09:09:09 +0000 (12:09 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 3 Apr 2023 11:13:44 +0000 (12:13 +0100)
The original patch uses a feature in lib/vsprintf.c to handle the invalid
address when tring to print *_fw_module->man4_module_entry.name when the
*rc_fw_module is NULL.
This case is handled by check_pointer_msg() internally and turns the
invalid pointer to '(efault)' for printing but it is hiding useful
information about the circumstances. Change the print to emmit the name
of the widget and a note on which side's fw_module is missing.

Fixes: e3720f92e023 ("ASoC: SOF: avoid a NULL dereference with unsupported widgets")
Reported-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/alsa-devel/4826f662-42f0-4a82-ba32-8bf5f8a03256@kili.mountain/
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.'
Link: https://lore.kernel.org/r/20230403090909.18233-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/ipc4-topology.c

index 669b99a..3a5394c 100644 (file)
@@ -1806,10 +1806,12 @@ static int sof_ipc4_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route *
        int ret;
 
        if (!src_fw_module || !sink_fw_module) {
-               /* The NULL module will print as "(efault)" */
-               dev_err(sdev->dev, "source %s or sink %s widget weren't set up properly\n",
-                       src_fw_module->man4_module_entry.name,
-                       sink_fw_module->man4_module_entry.name);
+               dev_err(sdev->dev,
+                       "cannot bind %s -> %s, no firmware module for: %s%s\n",
+                       src_widget->widget->name, sink_widget->widget->name,
+                       src_fw_module ? "" : " source",
+                       sink_fw_module ? "" : " sink");
+
                return -ENODEV;
        }