Re: [kbuild] [socfpga-nex:master-ltc-regulator 4/10] drivers/tty/newhaven_lcd.c:145:36-37: WARNING: Use ARRAY_SIZE
On Sun, Aug 24, 2014 at 09:47:40AM +0200, Julia Lawall wrote: Both look reasonable. The attachments were lost. I've attached them. The missing NULL terminator seems especially important. regards, dan carpenter From: Fengguang Wu fengguang...@intel.com Subject: [PATCH] fix coccinelle warnings TO: Alan Tull at...@opensource.altera.com CC: Alan Tull at...@opensource.altera.com CC: linux-ker...@vger.kernel.org CC: devicet...@vger.kernel.org drivers/tty/newhaven_lcd.c:606:49-50: lcd_of_match is not NULL terminated at line 606 Make sure of_device_id tables are NULL terminated Generated by: scripts/coccinelle/misc/of_table.cocci CC: Alan Tull at...@opensource.altera.com Signed-off-by: Fengguang Wu fengguang...@intel.com --- Please take the patch only if it's a positive warning. Thanks! newhaven_lcd.c |1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/newhaven_lcd.c +++ b/drivers/tty/newhaven_lcd.c @@ -604,6 +604,7 @@ static int __exit lcd_remove(struct i2c_ static const struct of_device_id lcd_of_match[] = { { .compatible = newhaven,nhd-0216k3z-nsw-bbw, }, + {}, }; static const struct i2c_device_id lcd_id[] = { From: Fengguang Wu fengguang...@intel.com Subject: [PATCH] fix coccinelle warnings TO: Alan Tull at...@opensource.altera.com CC: Alan Tull at...@opensource.altera.com CC: linux-ker...@vger.kernel.org CC: devicet...@vger.kernel.org drivers/tty/newhaven_lcd.c:145:36-37: WARNING: Use ARRAY_SIZE Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element Semantic patch information: This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Generated by: scripts/coccinelle/misc/array_size.cocci CC: Alan Tull at...@opensource.altera.com Signed-off-by: Fengguang Wu fengguang...@intel.com --- Please take the patch only if it's a positive warning. Thanks! newhaven_lcd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/newhaven_lcd.c +++ b/drivers/tty/newhaven_lcd.c @@ -142,7 +142,7 @@ static int lcd_load_custom_fonts(struct u8 buf[LCD_BYTES_PER_FONT_CMD]; int count, i; - for (i = 0; i sizeof(custom_fonts) / sizeof(struct custom_font) ; i++) { + for (i = 0; i ARRAY_SIZE(custom_fonts); i++) { buf[0] = LCD_COMMAND; buf[1] = LCD_CUSTOM_CHAR; buf[2] = custom_fonts[i].mapping; ___ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild
[kbuild] [socfpga-nex:master-ltc-regulator 4/10] drivers/tty/newhaven_lcd.c:145:36-37: WARNING: Use ARRAY_SIZE
TO: Alan Tull at...@opensource.altera.com tree: git://git.rocketboards.org/linux-socfpga-next master-ltc-regulator head: c7bf0104fa02d8abbaf759abb77c25620e62f884 commit: 095771f946b9c08200797d984ab3a9811cfc8e7c [4/10] newhaven lcd from socfpga-3.15 :: branch date: 86 minutes ago :: commit date: 32 hours ago drivers/tty/newhaven_lcd.c:145:36-37: WARNING: Use ARRAY_SIZE -- drivers/tty/newhaven_lcd.c:606:49-50: lcd_of_match is not NULL terminated at line 606 Please consider folding the attached diff :-) --- 0-DAY kernel build testing backend Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation From: Fengguang Wu fengguang...@intel.com Subject: [PATCH] fix coccinelle warnings TO: Alan Tull at...@opensource.altera.com CC: Alan Tull at...@opensource.altera.com CC: linux-ker...@vger.kernel.org CC: devicet...@vger.kernel.org drivers/tty/newhaven_lcd.c:145:36-37: WARNING: Use ARRAY_SIZE Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element Semantic patch information: This makes an effort to find cases where ARRAY_SIZE can be used such as where there is a division of sizeof the array by the sizeof its first element or by any indexed element or the element type. It replaces the division of the two sizeofs by ARRAY_SIZE. Generated by: scripts/coccinelle/misc/array_size.cocci CC: Alan Tull at...@opensource.altera.com Signed-off-by: Fengguang Wu fengguang...@intel.com --- Please take the patch only if it's a positive warning. Thanks! newhaven_lcd.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/newhaven_lcd.c +++ b/drivers/tty/newhaven_lcd.c @@ -142,7 +142,7 @@ static int lcd_load_custom_fonts(struct u8 buf[LCD_BYTES_PER_FONT_CMD]; int count, i; - for (i = 0; i sizeof(custom_fonts) / sizeof(struct custom_font) ; i++) { + for (i = 0; i ARRAY_SIZE(custom_fonts); i++) { buf[0] = LCD_COMMAND; buf[1] = LCD_CUSTOM_CHAR; buf[2] = custom_fonts[i].mapping; From: Fengguang Wu fengguang...@intel.com Subject: [PATCH] fix coccinelle warnings TO: Alan Tull at...@opensource.altera.com CC: Alan Tull at...@opensource.altera.com CC: linux-ker...@vger.kernel.org CC: devicet...@vger.kernel.org drivers/tty/newhaven_lcd.c:606:49-50: lcd_of_match is not NULL terminated at line 606 Make sure of_device_id tables are NULL terminated Generated by: scripts/coccinelle/misc/of_table.cocci CC: Alan Tull at...@opensource.altera.com Signed-off-by: Fengguang Wu fengguang...@intel.com --- Please take the patch only if it's a positive warning. Thanks! newhaven_lcd.c |1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/newhaven_lcd.c +++ b/drivers/tty/newhaven_lcd.c @@ -604,6 +604,7 @@ static int __exit lcd_remove(struct i2c_ static const struct of_device_id lcd_of_match[] = { { .compatible = newhaven,nhd-0216k3z-nsw-bbw, }, + {}, }; static const struct i2c_device_id lcd_id[] = { ___ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild