All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Mark Brown <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: Re: [PATCH 1/5] sound: SoC: sof: no need to check return value of debugfs_create functions
Date: Fri, 14 Jun 2019 17:27:04 +0200	[thread overview]
Message-ID: <20190614152704.GB18049@kroah.com> (raw)
In-Reply-To: <20190614151410.GC5316@sirena.org.uk>

On Fri, Jun 14, 2019 at 04:14:10PM +0100, Mark Brown wrote:
> On Fri, Jun 14, 2019 at 11:47:52AM +0200, Greg Kroah-Hartman wrote:
> > When calling debugfs functions, there is no need to ever check the
> > return value.  The function can work or not, but the code logic should
> > never do something different based on this.
> 
> > +++ b/sound/soc/sof/debug.c
> > @@ -77,8 +77,7 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,
> >  		if (!pm_runtime_active(sdev->dev) &&
> >  		    dfse->access_type == SOF_DEBUGFS_ACCESS_D0_ONLY) {
> >  			dev_err(sdev->dev,
> > -				"error: debugfs entry %s cannot be read in DSP D3\n",
> > -				dfse->dfsentry->d_name.name);
> > +				"error: debugfs entry cannot be read in DSP D3\n");
> >  			kfree(buf);
> >  			return -EINVAL;
> >  		}
> 
> This appears to be an unrelated change with no description in the
> changelog, please split it out into a separate change with a description
> of the change.

The whole "dfsentry" variable is now gone, so it is very related.  Why
split this out?

> > @@ -119,13 +119,8 @@ static int trace_debugfs_create(struct snd_sof_dev *sdev)
> >  	dfse->size = sdev->dmatb.bytes;
> >  	dfse->sdev = sdev;
> >  
> > -	dfse->dfsentry = debugfs_create_file("trace", 0444, sdev->debugfs_root,
> > -					     dfse, &sof_dfs_trace_fops);
> > -	if (!dfse->dfsentry) {
> > -		/* can't rely on debugfs, only log error and keep going */
> > -		dev_err(sdev->dev,
> > -			"error: cannot create debugfs entry for trace\n");
> > -	}
> > +	debugfs_create_file("trace", 0444, sdev->debugfs_root, dfse,
> > +			    &sof_dfs_trace_fops);
> 
> I might be missing something but I can't see any error logging in
> debugfs_create_file() so this isn't equivalent (though the current code
> is broken, it should be using IS_ERR()).  Logging creation failures is
> helpful to developers trying to figure out what happened to the trace
> files they're trying to use.

There is no need to log anything in in-kernel, working code.  If a
developer wants to do this on their own when writing the code the first
time and debugging it, great, but for stuff we know works, there's no
need for being noisy.

Also, the check is incorrect, there's no way for this function to return
NULL, so that code today, will never trigger.  So obviously no one
counted on this message anyway :)

Just call the function and move on, like the rest of the kernel is being
converted over to do.

thanks,

greg k-h

  reply	other threads:[~2019-06-14 15:27 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-14  9:47 [PATCH 1/5] sound: SoC: sof: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-14  9:47 ` [PATCH 2/5] sound: soc: skylake: " Greg Kroah-Hartman
2019-06-22 19:57   ` Cezary Rojewski
2019-06-22 20:39     ` Takashi Iwai
     [not found]       ` <20190624105334.GJ5316@sirena.org.uk>
2019-06-24 13:15         ` Takashi Iwai
2019-06-24 13:33           ` Mark Brown
2019-06-27  0:23             ` Greg Kroah-Hartman
2019-06-23  4:57     ` Greg Kroah-Hartman
2019-06-23 15:18       ` Cezary Rojewski
2019-06-23 15:55         ` Greg Kroah-Hartman
2019-06-14  9:47 ` [PATCH 3/5] sound: soc: codecs: wm_adsp: " Greg Kroah-Hartman
2019-06-14 10:24   ` Richard Fitzgerald
2019-06-14 15:43   ` Applied "ASoC: wm_adsp: no need to check return value of debugfs_create functions" to the asoc tree Mark Brown
2019-06-14  9:47 ` [PATCH 4/5] sound: soc: fsl: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-14 15:43   ` Applied "ASoC: fsl: no need to check return value of debugfs_create functions" to the asoc tree Mark Brown
2019-06-14  9:47 ` [PATCH 5/5] sound: soc: core: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-14 15:34   ` Mark Brown
2019-06-14 16:13     ` Greg Kroah-Hartman
2019-06-14 17:41       ` Mark Brown
2019-06-14 14:59 ` [PATCH 1/5] sound: SoC: sof: " Mark Brown
2019-06-14 15:28   ` Greg Kroah-Hartman
2019-06-14 15:14 ` Mark Brown
2019-06-14 15:27   ` Greg Kroah-Hartman [this message]
2019-06-14 16:37     ` Mark Brown

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=20190614152704.GB18049@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.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.