Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1035547rwd; Thu, 1 Jun 2023 09:35:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ578idOnG1Ei4nbhGDnCdTEqXIFCz3J0RFWxsRln8zRBVOK/h9e+u7cfseIipxLcsIa9gxu X-Received: by 2002:a17:902:e846:b0:1b1:9463:79d2 with SMTP id t6-20020a170902e84600b001b1946379d2mr2846439plg.38.1685637312974; Thu, 01 Jun 2023 09:35:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685637312; cv=none; d=google.com; s=arc-20160816; b=IQtyEun9c6nlzHZMXZ7mlF1zyjoBMUDa2GOAhxI0rZTlDXyn3v4CSoLc9ZIFp+1XBT t71YpZFd620JZBRgwuKvIih2ycTKf+Bqmxj6p7FgfU+BYJOKz9CiwgWrgBVA7N0ClFic 7WihsF6QABRIU1voY0tXJfBuYQPNpVIBssY2qZQfK2x1GscZQHK6mxC5fosYpuCiCp1F mlF71QkDUHCjmlEXVDDDCRO4VX6NiJMyVo66NA/513bUU5lGZK+7a+Hx2PMBYNy4XUwD Eh/oqZwJfzTOQtqzBj7GEqFNljGzSK1n5yTHMNhNECDjkQW3NTNMH8JoUcfcereaJ8FK e3ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8aVpdlwW2w+KYJE7+AHWZW/cn5CRFeVkk84n9PBWCZg=; b=XONepUA1LOdtlDDpWWPC4XzTPUZ9wCW7eYE/DBfj0mBvCPc16ltQElYcruJJhO2SAr IOztAWok59TsrpqzbpSMi8Hn8bpubvf4UA9Tphdhqp1b+RyUxxjzqzYwaDt28xvvtcYZ 7RxGRVCjnv2bsKRFKT/J9QArIojnbA444ZijyNLw8tPwJdg2sX7bhTiMHjp62t2YzG06 ZH1L7CyVbJcZXqBJZNVA9Y7ecXbFeTwXNdgz27iC8/CrBDxSDjTQT9fWZuGG9Kd/MCdp kZkhlAZ67t5esexwFT9Y4cMO3cOo4kRtqQsWehLt1S0/CavpEECCRJ0j+gplDr+5q35D 8Ftg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=UnT+dCfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u12-20020a170902e5cc00b001a1f6671a6dsi3054055plf.397.2023.06.01.09.34.57; Thu, 01 Jun 2023 09:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=UnT+dCfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229554AbjFAQQj (ORCPT + 99 others); Thu, 1 Jun 2023 12:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230471AbjFAQQh (ORCPT ); Thu, 1 Jun 2023 12:16:37 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C9A613D for ; Thu, 1 Jun 2023 09:16:35 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3517XPpJ025991; Thu, 1 Jun 2023 11:16:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=8aVpdlwW2w+KYJE7+AHWZW/cn5CRFeVkk84n9PBWCZg=; b=UnT+dCfq2a2bFjbclyx2HycRQiGETWpiqvhOfPpN7Gd99gL0/qednxFwBQ83aDKqn6kv vC0OtM6h+7BwfaIsf+6wKMeRIYgXRirdwU/9JX2vVeJo/bNa2223eE0Yhst/HtRmHjUW 4Qq7fNxE2rUpDfQcLBFtvxo3fND0T3B7OzuoCTsJ/ul5cgQ3+S5AJo8n8mWg7pX4DUmZ W2Du4LiZS/3HxI+WMWXqizuyzHEJy+Mb0eGADGEnJpdST9ML+a0ns+sGXlRKGSH29Amr JwKF4kQxFOGgwNzdDe86WSOrtBPZCkTO6VG7dAp1cTg8frQS2y+yV9MEW1GOdEcDns4O vg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3que9mxmbt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 11:16:24 -0500 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Thu, 1 Jun 2023 17:16:23 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Thu, 1 Jun 2023 17:16:23 +0100 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id EACCD15B7; Thu, 1 Jun 2023 16:16:22 +0000 (UTC) From: Charles Keepax To: CC: , , , , , Subject: [PATCH 4/4] soundwire: stream: Tidy do_bank_switch error messages Date: Thu, 1 Jun 2023 17:16:22 +0100 Message-ID: <20230601161622.1808135-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230601161622.1808135-1-ckeepax@opensource.cirrus.com> References: <20230601161622.1808135-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: lPtkQwjhyZbOsug5tD47n3WRBjOJE70v X-Proofpoint-ORIG-GUID: lPtkQwjhyZbOsug5tD47n3WRBjOJE70v X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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