Message ID | 20221128221152.2.I8d1993f41f0da1eac0ecba321678ac489f9c0b9b@changeid |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5973871wrr; Mon, 28 Nov 2022 14:13:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf5vuBNivTypQAQ69Oq0nG+AYXp5iCG0w7biJi1TPnBBybzUU3yugrznPsSfk6+8oBMUkWL1 X-Received: by 2002:a17:902:ccc3:b0:189:808b:c659 with SMTP id z3-20020a170902ccc300b00189808bc659mr10507982ple.13.1669673593520; Mon, 28 Nov 2022 14:13:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669673593; cv=none; d=google.com; s=arc-20160816; b=c2G7b6A+qIDhceijgzsiG0zRZ8U6Mji/wK7uO3hsI1+Ze0o7fewmnWOXYyvq2aBIVu qCHVSJdmPfLEfHJQ3VofcYv3l8SvWvTAX0cyFLNXR215I/9E8/4jm3TXStAPg2QxpP6w de218f6/J7fQX8vurUDkYj4aFJQsxY53SKDEO13TqmGOB75uZ1YEgfIRKa8+2w38TQPY iLfLBIYsAHFHx0hW7iWCy1mPjTi9WySUDBFQXkTmgoQxI+h15crjMM7IBz+2yXjgwqWN rY0TVyLSkGgBYPLZXQaGhVDXNdQa3/sMH/bB2Y8wAeY3DfTLDtxq3VyDZBFCTcYXLHfV dCrw== 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=Sqj31xD4hPaFJyMRspnZtLV/GdibyQshhKJftkXPTVY=; b=G2v6huOFp2Q0tr/flayoaM9Wh0vFHJxptVN0bir1TizZElT+WP24SyUjCpNVd+Mga8 64PdMjoT4qugOQYff9taJztZqwaOnmZ4USEW2HGW2yxqLrQYuNAo+NQeXCkGWMor6G5K fhSgdlyYeGefPtafFRy58IFELxL/dp4g5G+yPLrYAPLUdhed6ko0hUur8y66s1//EczJ FH80cfD1CwOqnp3NrmSaXO1XH+N9SU/Nhz+p4DZPC89hu03LjhNRcdNXzK/UUcTb598o SCzRkprq5/zbX7ziZ51/j9gHgWrbWuFdEpifFXauOzZ7a3p2zl0AqensD+FVKSI9oq9X wNLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=LX1I5X2T; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a17090301cd00b0018862b8c9a2si12797525plh.12.2022.11.28.14.13.00; Mon, 28 Nov 2022 14:13:13 -0800 (PST) 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=@chromium.org header.s=google header.b=LX1I5X2T; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234148AbiK1WMC (ORCPT <rfc822;gah0developer@gmail.com> + 99 others); Mon, 28 Nov 2022 17:12:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234455AbiK1WMA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 28 Nov 2022 17:12:00 -0500 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 586B930F60 for <linux-kernel@vger.kernel.org>; Mon, 28 Nov 2022 14:11:59 -0800 (PST) Received: by mail-io1-xd2b.google.com with SMTP id b2so8719068iof.12 for <linux-kernel@vger.kernel.org>; Mon, 28 Nov 2022 14:11:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sqj31xD4hPaFJyMRspnZtLV/GdibyQshhKJftkXPTVY=; b=LX1I5X2Tqi3H4osOssCuWhQxDxiOSlkZYdf+xSNNQ5ROewNwQQhCSV6qRABxIV2Bks oYRqoJPX71/O7LWeXlCZXMdXOJYPsyjuD4LOYDUmiqHaJXS34kSPYV3r0aSd22RTBcvD HpGsQZUSAGnCIdx7iCLmqGl1ZVN/RS78RxSwQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sqj31xD4hPaFJyMRspnZtLV/GdibyQshhKJftkXPTVY=; b=7j/h6fHsfEzXVOG9MHEk47tW3PlkBGMnZaXcpwk/lCXogWDjGmGkiyx8W5Z/u1IE+P 0qbihT4eErESE/r6dQSARPlpqeuhk8WRIo5Gl4wqN6g1gULDqo89j13GNUo4Q2kxsIPg Y36MAxX9rU3x5rTuSYtUyCHspkVjlxC5KcsNHYLe5TUVDPW6q9MiUjm5ABvVy0nEmW5I VDWHuDvPz/fJRGnsf/ATFugKSZFHbSiz9HNUm5eGYHMyox745NacBB4zkQwYwmj3AdO1 sSEC8xk/TME71iqutRx60FLAddBPpfDKH02r0wPgKjAFyVKdl1aCk9Cl2AtcKWb1POoS 10sw== X-Gm-Message-State: ANoB5pnXOGPs4WJHXwCQgu0naoG8wteEGqWvQEAFFuFBC3EB/oGj4Y3T IBlGAUU3mdb06IMTu6AODASS6w== X-Received: by 2002:a05:6602:21c2:b0:6c3:168a:a25e with SMTP id c2-20020a05660221c200b006c3168aa25emr17433231ioc.174.1669673518761; Mon, 28 Nov 2022 14:11:58 -0800 (PST) Received: from localhost (30.23.70.34.bc.googleusercontent.com. [34.70.23.30]) by smtp.gmail.com with UTF8SMTPSA id a15-20020a92ce4f000000b00302bcbad239sm3827937ilr.77.2022.11.28.14.11.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Nov 2022 14:11:58 -0800 (PST) From: Matthias Kaehlcke <mka@chromium.org> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Banajit Goswami <bgoswami@quicinc.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com> Cc: alsa-devel@alsa-project.org, Douglas Anderson <dianders@chromium.org>, Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>, linux-kernel@vger.kernel.org, Judy Hsiao <judyhsiao@google.com>, Matthias Kaehlcke <mka@chromium.org> Subject: [PATCH 2/2] ASoC: qcom: lpass-sc7180: Return 0 instead of 'ret' at the end of _resume() Date: Mon, 28 Nov 2022 22:11:55 +0000 Message-Id: <20221128221152.2.I8d1993f41f0da1eac0ecba321678ac489f9c0b9b@changeid> X-Mailer: git-send-email 2.38.1.584.g0f3c55d4c2-goog In-Reply-To: <20221128221152.1.Ia805c688ee968fbbec7b93dc10742876fdef8024@changeid> References: <20221128221152.1.Ia805c688ee968fbbec7b93dc10742876fdef8024@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750779657828053486?= X-GMAIL-MSGID: =?utf-8?q?1750779657828053486?= |
Series |
[1/2] ASoC: qcom: lpass-sc7180: Drop unnecessary initialization in _resume()
|
|
Commit Message
Matthias Kaehlcke
Nov. 28, 2022, 10:11 p.m. UTC
sc7180_lpass_dev_resume() returns 'ret' at the end of the function,
where 'ret' is always 0. Just return 0 to make it plain obvious that
this is always the success path.
Also add an empty line between the error handling path and the
return.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---
sound/soc/qcom/lpass-sc7180.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hi, On Mon, Nov 28, 2022 at 2:12 PM Matthias Kaehlcke <mka@chromium.org> wrote: > > sc7180_lpass_dev_resume() returns 'ret' at the end of the function, > where 'ret' is always 0. Just return 0 to make it plain obvious that > this is always the success path. > > Also add an empty line between the error handling path and the > return. > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > --- > > sound/soc/qcom/lpass-sc7180.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c > index 7a81e609727c..30a28e3152cb 100644 > --- a/sound/soc/qcom/lpass-sc7180.c > +++ b/sound/soc/qcom/lpass-sc7180.c > @@ -173,7 +173,8 @@ static int sc7180_lpass_dev_resume(struct device *dev) > dev_err(dev, "sc7180 clk prepare and enable failed\n"); > return ret; > } > - return ret; > + > + return 0; Yeah, I noticed this too when I was approving your pick. FWIW, I probably would have written this way, but it's 6 of one and half dozen of the other: if (ret) dev_err(dev, ...); return ret; ...but I just dug a tiny bit deeper and actually, there's no need for the error print here and it's just wasteful. clk_bulk_prepare_enable() already prints errors for you. So really this whole function could just be: struct lpass_data *drvdata = dev_get_drvdata(dev); return clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks); I guess theoretically one could even go further and look at pm_clk, but perhaps that's overboard. -Doug
On Mon, Nov 28, 2022 at 02:48:28PM -0800, Doug Anderson wrote: > Hi, > > On Mon, Nov 28, 2022 at 2:12 PM Matthias Kaehlcke <mka@chromium.org> wrote: > > > > sc7180_lpass_dev_resume() returns 'ret' at the end of the function, > > where 'ret' is always 0. Just return 0 to make it plain obvious that > > this is always the success path. > > > > Also add an empty line between the error handling path and the > > return. > > > > Signed-off-by: Matthias Kaehlcke <mka@chromium.org> > > --- > > > > sound/soc/qcom/lpass-sc7180.c | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c > > index 7a81e609727c..30a28e3152cb 100644 > > --- a/sound/soc/qcom/lpass-sc7180.c > > +++ b/sound/soc/qcom/lpass-sc7180.c > > @@ -173,7 +173,8 @@ static int sc7180_lpass_dev_resume(struct device *dev) > > dev_err(dev, "sc7180 clk prepare and enable failed\n"); > > return ret; > > } > > - return ret; > > + > > + return 0; > > Yeah, I noticed this too when I was approving your pick. FWIW, I > probably would have written this way, but it's 6 of one and half dozen > of the other: > > if (ret) > dev_err(dev, ...); > return ret; Yeah, I was considering this too, either is fine IMO :) > ...but I just dug a tiny bit deeper and actually, there's no need for > the error print here and it's just wasteful. clk_bulk_prepare_enable() > already prints errors for you. So really this whole function could > just be: > > struct lpass_data *drvdata = dev_get_drvdata(dev); > return clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clks); Right, the log isn't really needed if clk_bulk_prepare_enable() already logs errors. I'll adjust the patch accordingly, and drop the first one since 'ret' is going away. > I guess theoretically one could even go further and look at pm_clk, > but perhaps that's overboard. Maybe let's leave that for another iteration :) Thanks for the review! m.
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c index 7a81e609727c..30a28e3152cb 100644 --- a/sound/soc/qcom/lpass-sc7180.c +++ b/sound/soc/qcom/lpass-sc7180.c @@ -173,7 +173,8 @@ static int sc7180_lpass_dev_resume(struct device *dev) dev_err(dev, "sc7180 clk prepare and enable failed\n"); return ret; } - return ret; + + return 0; } static int sc7180_lpass_dev_suspend(struct device *dev)