[PATCH] Sound:last.c: fix code syle trailing white space - modify printk()->netdev_dbg() - Possible unnecessary KERN_INFO removed

jack1989s@gmail.com posted 1 patch 2 years, 9 months ago
sound/last.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] Sound:last.c: fix code syle trailing white space - modify printk()->netdev_dbg() - Possible unnecessary KERN_INFO removed
Posted by jack1989s@gmail.com 2 years, 9 months ago
From: Federico Di Lembo <jack1989s@gmail.com>

Fixing coding style.

Signed-off-by: Federico Di Lembo <jack1989s@gmail.com>
---
 sound/last.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/last.c b/sound/last.c
index f0bb98780e70..b8cfd6ded95d 100644
--- a/sound/last.c
+++ b/sound/last.c
@@ -11,18 +11,18 @@ static int __init alsa_sound_last_init(void)
 {
 	struct snd_card *card;
 	int idx, ok = 0;
-	
-	printk(KERN_INFO "ALSA device list:\n");
+
+	netdev_dbg("ALSA device list:\n");
 	for (idx = 0; idx < SNDRV_CARDS; idx++) {
 		card = snd_card_ref(idx);
 		if (card) {
-			printk(KERN_INFO "  #%i: %s\n", idx, card->longname);
+			netdev_dbg("  #%i: %s\n", idx, card->longname);
 			snd_card_unref(card);
 			ok++;
 		}
 	}
 	if (ok == 0)
-		printk(KERN_INFO "  No soundcards found.\n");
+		netdev_dbg("  No soundcards found.\n");
 	return 0;
 }
 
-- 
2.34.1
Re: [PATCH] Sound:last.c: fix code syle trailing white space - modify printk()->netdev_dbg() - Possible unnecessary KERN_INFO removed
Posted by Takashi Iwai 2 years, 9 months ago
On Sun, 07 May 2023 15:00:21 +0200,
jack1989s@gmail.com wrote:
> 
> From: Federico Di Lembo <jack1989s@gmail.com>
> 
> Fixing coding style.
> 
> Signed-off-by: Federico Di Lembo <jack1989s@gmail.com>

In general, we don't take a patch just for white space without any
real need.  Please do a cleanup together with other real fix or
enhancement patches.

Also, the use of netdev_dbg() doesn't make sense here at all; the code
has nothing to do with the network.

Last but not least, you change the printk level by the conversion
silently.  It's really bad, please don't.  If you have to change the
printk level, give the convincing explanation.


thanks,

Takashi


> ---
>  sound/last.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/last.c b/sound/last.c
> index f0bb98780e70..b8cfd6ded95d 100644
> --- a/sound/last.c
> +++ b/sound/last.c
> @@ -11,18 +11,18 @@ static int __init alsa_sound_last_init(void)
>  {
>  	struct snd_card *card;
>  	int idx, ok = 0;
> -	
> -	printk(KERN_INFO "ALSA device list:\n");
> +
> +	netdev_dbg("ALSA device list:\n");
>  	for (idx = 0; idx < SNDRV_CARDS; idx++) {
>  		card = snd_card_ref(idx);
>  		if (card) {
> -			printk(KERN_INFO "  #%i: %s\n", idx, card->longname);
> +			netdev_dbg("  #%i: %s\n", idx, card->longname);
>  			snd_card_unref(card);
>  			ok++;
>  		}
>  	}
>  	if (ok == 0)
> -		printk(KERN_INFO "  No soundcards found.\n");
> +		netdev_dbg("  No soundcards found.\n");
>  	return 0;
>  }
>  
> -- 
> 2.34.1
>
Re: [PATCH] Sound:last.c: fix code syle trailing white space - modify printk()->netdev_dbg() - Possible unnecessary KERN_INFO removed
Posted by kernel test robot 2 years, 9 months ago
Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on tiwai-sound/for-next]
[also build test ERROR on tiwai-sound/for-linus linus/master v6.3 next-20230505]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/jack1989s-gmail-com/Sound-last-c-fix-code-syle-trailing-white-space-modify-printk-netdev_dbg-Possible-unnecessary-KERN_INFO-removed/20230507-210152
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git for-next
patch link:    https://lore.kernel.org/r/20230507130021.48112-1-jack1989s%40gmail.com
patch subject: [PATCH] Sound:last.c: fix code syle trailing white space - modify printk()->netdev_dbg() - Possible unnecessary KERN_INFO removed
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20230508/202305080037.fiQIAfoP-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
reproduce (this is a W=1 build):
        # https://github.com/intel-lab-lkp/linux/commit/467a3e6b911964a967ad7ce544c4426e4d95b14f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review jack1989s-gmail-com/Sound-last-c-fix-code-syle-trailing-white-space-modify-printk-netdev_dbg-Possible-unnecessary-KERN_INFO-removed/20230507-210152
        git checkout 467a3e6b911964a967ad7ce544c4426e4d95b14f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=x86_64 olddefconfig
        make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202305080037.fiQIAfoP-lkp@intel.com/

All errors (new ones prefixed by >>):

   sound/last.c: In function 'alsa_sound_last_init':
>> sound/last.c:15:9: error: implicit declaration of function 'netdev_dbg'; did you mean 'dev_dbg'? [-Werror=implicit-function-declaration]
      15 |         netdev_dbg("ALSA device list:\n");
         |         ^~~~~~~~~~
         |         dev_dbg
   cc1: some warnings being treated as errors


vim +15 sound/last.c

     9	
    10	static int __init alsa_sound_last_init(void)
    11	{
    12		struct snd_card *card;
    13		int idx, ok = 0;
    14	
  > 15		netdev_dbg("ALSA device list:\n");
    16		for (idx = 0; idx < SNDRV_CARDS; idx++) {
    17			card = snd_card_ref(idx);
    18			if (card) {
    19				netdev_dbg("  #%i: %s\n", idx, card->longname);
    20				snd_card_unref(card);
    21				ok++;
    22			}
    23		}
    24		if (ok == 0)
    25			netdev_dbg("  No soundcards found.\n");
    26		return 0;
    27	}
    28	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests