All of lore.kernel.org
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Mark Brown" <broonie@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>, 朱灿灿 <zhucancan@vivo.com>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] ASoC: soc-pcm: Fix uninitialised return value in variable ret
Date: Tue, 12 Jan 2021 10:24:21 +0000	[thread overview]
Message-ID: <69547a3a-8b58-69cc-af87-fac7b7d03cb4@canonical.com> (raw)
In-Reply-To: <20210112102204.GG5083@kadam>

On 12/01/2021 10:22, Dan Carpenter wrote:
> On Mon, Jan 11, 2021 at 05:37:36PM +0000, Colin Ian King wrote:
>> On 11/01/2021 16:35, Mark Brown wrote:
>>> On Fri, Jan 08, 2021 at 12:35:46PM +0000, Colin King wrote:
>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> Currently when attempting to start the BE fails because the
>>>> FE is not started the error return variable ret is not initialized
>>>> and garbage is returned.  Fix this by setting it to 0 so the
>>>
>>> This doesn't apply against current code, please check and resend.
>>>
>>
>> Current ASoC tree now has two commits:
>>
>> commit 4eeed5f40354735c4e68e71904db528ed19c9cbb
>> Author: Souptick Joarder <jrdr.linux@gmail.com>
>> Date:   Sat Jan 9 09:15:01 2021 +0530
>>
>>     ASoC: soc-pcm: return correct -ERRNO in failure path
>>
>> commit e91b65b36fde0690f1c694f17dd1b549295464a7
>> Author: Dan Carpenter <dan.carpenter@oracle.com>
>> Date:   Mon Jan 11 12:50:21 2021 +0300
>>
>>     ASoC: soc-pcm: Fix an uninitialized error code
>>
>> ..both set ret to non-zero, which I believe will throw a subsequent
>> warning messagethat's not strictly related.
> 
> My patch restored the original behavior.  And I think that errors should
> return error codes.  What you're saying is basically "Returning an error
> is a bug because it will trigger an error message in the caller".  So
> then we have to have a debate about printks as a layering violation.
> 
> I don't like error messages generally, because I think they make the
> code messy.  A lot of people put error messages for impossible things.
> Or if a kmalloc() fails or whatever.  There are too many error messages
> which people add in an auto-pilot way without considering whether it's
> necessary.
> 
> But some people think, and maybe they're correct, that it's best if
> every function in the call tree prints a message.  That way you can
> trace the error path easily.

+1

Yep, good point, ignore my fix. Thanks Dan for your observations.

> 
> regards,
> dan carpenter
> 


WARNING: multiple messages have this Message-ID (diff)
From: Colin Ian King <colin.king@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	朱灿灿 <zhucancan@vivo.com>, "Takashi Iwai" <tiwai@suse.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] ASoC: soc-pcm: Fix uninitialised return value in variable ret
Date: Tue, 12 Jan 2021 10:24:21 +0000	[thread overview]
Message-ID: <69547a3a-8b58-69cc-af87-fac7b7d03cb4@canonical.com> (raw)
In-Reply-To: <20210112102204.GG5083@kadam>

On 12/01/2021 10:22, Dan Carpenter wrote:
> On Mon, Jan 11, 2021 at 05:37:36PM +0000, Colin Ian King wrote:
>> On 11/01/2021 16:35, Mark Brown wrote:
>>> On Fri, Jan 08, 2021 at 12:35:46PM +0000, Colin King wrote:
>>>> From: Colin Ian King <colin.king@canonical.com>
>>>>
>>>> Currently when attempting to start the BE fails because the
>>>> FE is not started the error return variable ret is not initialized
>>>> and garbage is returned.  Fix this by setting it to 0 so the
>>>
>>> This doesn't apply against current code, please check and resend.
>>>
>>
>> Current ASoC tree now has two commits:
>>
>> commit 4eeed5f40354735c4e68e71904db528ed19c9cbb
>> Author: Souptick Joarder <jrdr.linux@gmail.com>
>> Date:   Sat Jan 9 09:15:01 2021 +0530
>>
>>     ASoC: soc-pcm: return correct -ERRNO in failure path
>>
>> commit e91b65b36fde0690f1c694f17dd1b549295464a7
>> Author: Dan Carpenter <dan.carpenter@oracle.com>
>> Date:   Mon Jan 11 12:50:21 2021 +0300
>>
>>     ASoC: soc-pcm: Fix an uninitialized error code
>>
>> ..both set ret to non-zero, which I believe will throw a subsequent
>> warning messagethat's not strictly related.
> 
> My patch restored the original behavior.  And I think that errors should
> return error codes.  What you're saying is basically "Returning an error
> is a bug because it will trigger an error message in the caller".  So
> then we have to have a debate about printks as a layering violation.
> 
> I don't like error messages generally, because I think they make the
> code messy.  A lot of people put error messages for impossible things.
> Or if a kmalloc() fails or whatever.  There are too many error messages
> which people add in an auto-pilot way without considering whether it's
> necessary.
> 
> But some people think, and maybe they're correct, that it's best if
> every function in the call tree prints a message.  That way you can
> trace the error path easily.

+1

Yep, good point, ignore my fix. Thanks Dan for your observations.

> 
> regards,
> dan carpenter
> 

  reply	other threads:[~2021-01-12 10:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 12:35 [PATCH][next] ASoC: soc-pcm: Fix uninitialised return value in variable ret Colin King
2021-01-08 12:35 ` Colin King
2021-01-11  9:56 ` 朱灿灿
2021-01-11 16:35 ` [PATCH][next] " Mark Brown
2021-01-11 16:35   ` Mark Brown
2021-01-11 17:07   ` Colin Ian King
2021-01-11 17:07     ` Colin Ian King
2021-01-11 17:09     ` Mark Brown
2021-01-11 17:09       ` Mark Brown
2021-01-11 17:37   ` Colin Ian King
2021-01-11 17:37     ` Colin Ian King
2021-01-11 17:58     ` Mark Brown
2021-01-11 17:58       ` Mark Brown
2021-01-12 10:22     ` Dan Carpenter
2021-01-12 10:22       ` Dan Carpenter
2021-01-12 10:22       ` Dan Carpenter
2021-01-12 10:24       ` Colin Ian King [this message]
2021-01-12 10:24         ` Colin Ian King

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=69547a3a-8b58-69cc-af87-fac7b7d03cb4@canonical.com \
    --to=colin.king@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=zhucancan@vivo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.