Skip to contentSkip to conversation

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

PATCH In review [email protected] 3 participants 3 messages May 7, 2023 – May 8, 2023 Sound

lore
Share & tools
lore
#0 lore raw

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

From: Federico Di Lembo <[email protected]>

Fixing coding style.

---
 sound/last.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/last.c +4 -4
index f0bb98780e70..b8cfd6ded95d 100644
@@ -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;
 }
 
Signature · 1 line
2.34.1
#1 lore raw
kernel test robot noticed the following build errors:

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/[email protected]/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 <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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	
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#2 lore raw
In reply to [email protected]
Quoted 6 lines · On Sun, 07 May 2023 15:00:21 +0200, [email protected] wrote:

From: Federico Di Lembo <[email protected]>

Fixing coding style.

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

Quoted 34 lines
---
 sound/last.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/last.c +4 -4
index f0bb98780e70..b8cfd6ded95d 100644
@@ -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;
 }
 
Signature · 1 line
2.34.1