mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: <vkoul@kernel.org>
Cc: <yung-chuan.liao@linux.intel.com>,
	<pierre-louis.bossart@linux.intel.com>, <sanyog.r.kale@intel.com>,
	<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>
Subject: [PATCH 4/4] soundwire: stream: Tidy do_bank_switch error messages
Date: Thu, 1 Jun 2023 17:16:22 +0100	[thread overview]
Message-ID: <20230601161622.1808135-4-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20230601161622.1808135-1-ckeepax@opensource.cirrus.com>

Every error path in do_bank_switch prints an error message so there is no
need for the callers to also print error messages. Indeed in multi-master
cases these extra messages are confusing because they print out against a
random bus device whereas the do_bank_switch messages print against the bus
that actually failed.

This also allows clean up of a couple of if's and variable initialisations
that were only there to silence potentially uninitialised variable
warnings on the bus variable.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 drivers/soundwire/stream.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 248ab243ec6e4..b5c7a52aac19e 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -1338,7 +1338,7 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
 			       bool update_params)
 {
 	struct sdw_master_runtime *m_rt;
-	struct sdw_bus *bus = NULL;
+	struct sdw_bus *bus;
 	struct sdw_master_prop *prop;
 	struct sdw_bus_params params;
 	int ret;
@@ -1380,16 +1380,9 @@ static int _sdw_prepare_stream(struct sdw_stream_runtime *stream,
 		}
 	}
 
-	if (!bus) {
-		pr_err("Configuration error in %s\n", __func__);
-		return -EINVAL;
-	}
-
 	ret = do_bank_switch(stream);
-	if (ret < 0) {
-		pr_err("%s: do_bank_switch failed: %d\n", __func__, ret);
+	if (ret < 0)
 		goto restore_params;
-	}
 
 	list_for_each_entry(m_rt, &stream->master_list, stream_node) {
 		bus = m_rt->bus;
@@ -1465,7 +1458,7 @@ EXPORT_SYMBOL(sdw_prepare_stream);
 static int _sdw_enable_stream(struct sdw_stream_runtime *stream)
 {
 	struct sdw_master_runtime *m_rt;
-	struct sdw_bus *bus = NULL;
+	struct sdw_bus *bus;
 	int ret;
 
 	/* Enable Master(s) and Slave(s) port(s) associated with stream */
@@ -1488,16 +1481,9 @@ static int _sdw_enable_stream(struct sdw_stream_runtime *stream)
 		}
 	}
 
-	if (!bus) {
-		pr_err("Configuration error in %s\n", __func__);
-		return -EINVAL;
-	}
-
 	ret = do_bank_switch(stream);
-	if (ret < 0) {
-		pr_err("%s: do_bank_switch failed: %d\n", __func__, ret);
+	if (ret < 0)
 		return ret;
-	}
 
 	stream->state = SDW_STREAM_ENABLED;
 	return 0;
@@ -1571,10 +1557,8 @@ static int _sdw_disable_stream(struct sdw_stream_runtime *stream)
 	}
 
 	ret = do_bank_switch(stream);
-	if (ret < 0) {
-		pr_err("%s: do_bank_switch failed: %d\n", __func__, ret);
+	if (ret < 0)
 		return ret;
-	}
 
 	/* make sure alternate bank (previous current) is also disabled */
 	list_for_each_entry(m_rt, &stream->master_list, stream_node) {
-- 
2.30.2


  parent reply	other threads:[~2023-06-01 16:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-01 16:16 [PATCH 1/4] soundwire: stream: Add missing clear of alloc_slave_rt Charles Keepax
2023-06-01 16:16 ` [PATCH 2/4] soundwire: bandwidth allocation: Remove pointless variable Charles Keepax
2023-06-01 16:39   ` Pierre-Louis Bossart
2023-06-01 16:16 ` [PATCH 3/4] soundwire: stream: Remove unnecessary gotos Charles Keepax
2023-06-01 16:37   ` Pierre-Louis Bossart
2023-06-02  8:40     ` Charles Keepax
2023-06-01 16:16 ` Charles Keepax [this message]
2023-06-01 16:34   ` [PATCH 4/4] soundwire: stream: Tidy do_bank_switch error messages Pierre-Louis Bossart
2023-06-02  8:38     ` Charles Keepax
2023-06-01 16:43 ` [PATCH 1/4] soundwire: stream: Add missing clear of alloc_slave_rt Pierre-Louis Bossart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230601161622.1808135-4-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®