[kbuild] drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be declared with const [constParameter]
:: :: Manual check reason: "low confidence static check warning: drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be declared with const [constParameter]" :: CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: linux-ker...@vger.kernel.org TO: Javier Martinez Canillas CC: Maxime Ripard tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 9b59ec8d50a1f28747ceff9a4f39af5deba9540e commit: a61732e808672cfa8c8c6028bcf9feacb953ef40 drm: Add driver for Solomon SSD130x OLED displays date: 5 months ago :: branch date: 9 hours ago :: commit date: 5 months ago compiler: hppa-linux-gcc (GCC) 12.1.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout a61732e808672cfa8c8c6028bcf9feacb953ef40 cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot cppcheck warnings: (new ones prefixed by >>) >> drivers/media/cec/platform/cros-ec/cros-ec-cec.c:97:26: warning: Local >> variable 'msg' shadows outer variable [shadowVariable] struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:97:26: note: Shadowed declaration struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:97:26: note: Shadow variable struct cros_ec_command msg; ^ >> drivers/media/cec/platform/cros-ec/cros-ec-cec.c:98:28: warning: Local >> variable 'data' shadows outer variable [shadowVariable] struct ec_params_cec_set data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:98:28: note: Shadowed declaration struct ec_params_cec_set data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:98:28: note: Shadow variable struct ec_params_cec_set data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:123:26: warning: Local variable 'msg' shadows outer variable [shadowVariable] struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:123:26: note: Shadowed declaration struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:123:26: note: Shadow variable struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:124:30: warning: Local variable 'data' shadows outer variable [shadowVariable] struct ec_params_cec_write data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:124:30: note: Shadowed declaration struct ec_params_cec_write data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:124:30: note: Shadow variable struct ec_params_cec_write data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:147:26: warning: Local variable 'msg' shadows outer variable [shadowVariable] struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:147:26: note: Shadowed declaration struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:147:26: note: Shadow variable struct cros_ec_command msg; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:148:28: warning: Local variable 'data' shadows outer variable [shadowVariable] struct ec_params_cec_set data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:148:28: note: Shadowed declaration struct ec_params_cec_set data; ^ drivers/media/cec/platform/cros-ec/cros-ec-cec.c:148:28: note: Shadow variable struct ec_params_cec_set data; ^ -- cppcheck possible warnings: (new ones prefixed by >>, may not real problems) drivers/gpu/drm/solomon/ssd130x.c:585:7: warning: Redundant initialization for 'mode'. The initialized value is overwritten before it is read. [redundantInitialization] mode = drm_mode_duplicate(connector->dev, >mode); ^ drivers/gpu/drm/solomon/ssd130x.c:582:32: note: mode is initialized struct drm_display_mode *mode = >mode; ^ drivers/gpu/drm/solomon/ssd130x.c:585:7: note: mode is overwritten mode = drm_mode_duplicate(connector->dev, >mode); ^ >> drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be >> declared with const [constParameter] static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf, ^ -- >> drivers/media/pci/ddbridge/ddbridge-mci.c:110:42: warning: Parameter 'key'
[kbuild] drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be declared with const [constParameter]
:: :: Manual check reason: "low confidence static check warning: drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be declared with const [constParameter]" :: CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: linux-ker...@vger.kernel.org TO: Javier Martinez Canillas CC: Maxime Ripard tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: f2906aa863381afb0015a9eb7fefad885d4e5a56 commit: a61732e808672cfa8c8c6028bcf9feacb953ef40 drm: Add driver for Solomon SSD130x OLED displays date: 4 months ago :: branch date: 19 hours ago :: commit date: 4 months ago compiler: s390-linux-gcc (GCC) 11.3.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout a61732e808672cfa8c8c6028bcf9feacb953ef40 cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot cppcheck warnings: (new ones prefixed by >>) drivers/md/dm-integrity.c:4493:7: warning: Local variable 'r' shadows outer variable [shadowVariable] int r; ^ drivers/md/dm-integrity.c:3966:6: note: Shadowed declaration int r; ^ drivers/md/dm-integrity.c:4493:7: note: Shadow variable int r; ^ cppcheck possible warnings: (new ones prefixed by >>, may not real problems) drivers/gpu/drm/solomon/ssd130x.c:585:7: warning: Redundant initialization for 'mode'. The initialized value is overwritten before it is read. [redundantInitialization] mode = drm_mode_duplicate(connector->dev, >mode); ^ drivers/gpu/drm/solomon/ssd130x.c:582:32: note: mode is initialized struct drm_display_mode *mode = >mode; ^ drivers/gpu/drm/solomon/ssd130x.c:585:7: note: mode is overwritten mode = drm_mode_duplicate(connector->dev, >mode); ^ >> drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be >> declared with const [constParameter] static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf, ^ -- >> drivers/media/i2c/ov7670.c:1283:7: warning: Parameter 'matrix' can be >> declared with const [constParameter] int matrix[CMATRIX_LEN]) ^ >> drivers/md/dm-crypt.c:2920:6: warning: Redundant initialization for 'ret'. >> The initialized value is overwritten before it is read. >> [redundantInitialization] ret = crypt_alloc_tfms(cc, cipher_api); ^ drivers/md/dm-crypt.c:2866:10: note: ret is initialized int ret = -EINVAL; ^ drivers/md/dm-crypt.c:2920:6: note: ret is overwritten ret = crypt_alloc_tfms(cc, cipher_api); ^ >> drivers/md/dm-integrity.c:2268:3: warning: Address of local auto-variable >> assigned to a function parameter. [autoVariables] dio->completion = _comp; ^ vim +/buf +348 drivers/gpu/drm/solomon/ssd130x.c a61732e808672c Javier Martinez Canillas 2022-02-14 347 a61732e808672c Javier Martinez Canillas 2022-02-14 @348 static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf, a61732e808672c Javier Martinez Canillas 2022-02-14 349 struct drm_rect *rect) a61732e808672c Javier Martinez Canillas 2022-02-14 350 { a61732e808672c Javier Martinez Canillas 2022-02-14 351 unsigned int x = rect->x1; a61732e808672c Javier Martinez Canillas 2022-02-14 352 unsigned int y = rect->y1; a61732e808672c Javier Martinez Canillas 2022-02-14 353 unsigned int width = drm_rect_width(rect); a61732e808672c Javier Martinez Canillas 2022-02-14 354 unsigned int height = drm_rect_height(rect); a61732e808672c Javier Martinez Canillas 2022-02-14 355 unsigned int line_length = DIV_ROUND_UP(width, 8); a61732e808672c Javier Martinez Canillas 2022-02-14 356 unsigned int pages = DIV_ROUND_UP(y % 8 + height, 8); a61732e808672c Javier Martinez Canillas 2022-02-14 357 u32 array_idx = 0; a61732e808672c Javier Martinez Canillas 2022-02-14 358 int ret, i, j, k; a61732e808672c Javier Martinez Canillas 2022-02-14 359 u8 *data_array = NULL; a61732e808672c Javier Martinez Canillas 2022-02-14 360 a61732e808672c Javier Martinez Canillas 2022-02-14 361 data_array = kcalloc(width, pages, GFP_KERNEL); a61732e808672c Javier Martinez Canillas 2022-02-14 362 if (!data_array) a61732e808672c Javier Martinez Canillas 2022-02-14 363 return -ENOMEM; a61732e808672c Javier Martinez Canillas 2022-02-14 364 a61732e808672c Javier Martinez Canillas 2022-02-14 365 /* a61732e808672c Javier Martinez Canillas 2022-02-14 366 * The screen is divided in pages, each having a height of 8 a61732e808672c Javier Martinez Canillas 2022-02-14 367 * pixels, and the width of the screen. When sending a byte of a61732e808672c
[kbuild] drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be declared with const [constParameter]
CC: kbuild-...@lists.01.org BCC: l...@intel.com CC: linux-ker...@vger.kernel.org TO: Javier Martinez Canillas CC: Maxime Ripard tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: c00c5e1d157bec0ef0b0b59aa5482eb8dc7e8e49 commit: a61732e808672cfa8c8c6028bcf9feacb953ef40 drm: Add driver for Solomon SSD130x OLED displays date: 9 weeks ago :: branch date: 3 hours ago :: commit date: 9 weeks ago compiler: arc-elf-gcc (GCC) 11.2.0 reproduce (cppcheck warning): # apt-get install cppcheck git checkout a61732e808672cfa8c8c6028bcf9feacb953ef40 cppcheck --quiet --enable=style,performance,portability --template=gcc FILE If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot cppcheck possible warnings: (new ones prefixed by >>, may not real problems) drivers/gpu/drm/solomon/ssd130x.c:585:7: warning: Redundant initialization for 'mode'. The initialized value is overwritten before it is read. [redundantInitialization] mode = drm_mode_duplicate(connector->dev, >mode); ^ drivers/gpu/drm/solomon/ssd130x.c:582:32: note: mode is initialized struct drm_display_mode *mode = >mode; ^ drivers/gpu/drm/solomon/ssd130x.c:585:7: note: mode is overwritten mode = drm_mode_duplicate(connector->dev, >mode); ^ >> drivers/gpu/drm/solomon/ssd130x.c:348:68: warning: Parameter 'buf' can be >> declared with const [constParameter] static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf, ^ vim +/buf +348 drivers/gpu/drm/solomon/ssd130x.c a61732e808672c Javier Martinez Canillas 2022-02-14 347 a61732e808672c Javier Martinez Canillas 2022-02-14 @348 static int ssd130x_update_rect(struct ssd130x_device *ssd130x, u8 *buf, a61732e808672c Javier Martinez Canillas 2022-02-14 349 struct drm_rect *rect) a61732e808672c Javier Martinez Canillas 2022-02-14 350 { a61732e808672c Javier Martinez Canillas 2022-02-14 351 unsigned int x = rect->x1; a61732e808672c Javier Martinez Canillas 2022-02-14 352 unsigned int y = rect->y1; a61732e808672c Javier Martinez Canillas 2022-02-14 353 unsigned int width = drm_rect_width(rect); a61732e808672c Javier Martinez Canillas 2022-02-14 354 unsigned int height = drm_rect_height(rect); a61732e808672c Javier Martinez Canillas 2022-02-14 355 unsigned int line_length = DIV_ROUND_UP(width, 8); a61732e808672c Javier Martinez Canillas 2022-02-14 356 unsigned int pages = DIV_ROUND_UP(y % 8 + height, 8); a61732e808672c Javier Martinez Canillas 2022-02-14 357 u32 array_idx = 0; a61732e808672c Javier Martinez Canillas 2022-02-14 358 int ret, i, j, k; a61732e808672c Javier Martinez Canillas 2022-02-14 359 u8 *data_array = NULL; a61732e808672c Javier Martinez Canillas 2022-02-14 360 a61732e808672c Javier Martinez Canillas 2022-02-14 361 data_array = kcalloc(width, pages, GFP_KERNEL); a61732e808672c Javier Martinez Canillas 2022-02-14 362 if (!data_array) a61732e808672c Javier Martinez Canillas 2022-02-14 363 return -ENOMEM; a61732e808672c Javier Martinez Canillas 2022-02-14 364 a61732e808672c Javier Martinez Canillas 2022-02-14 365 /* a61732e808672c Javier Martinez Canillas 2022-02-14 366 * The screen is divided in pages, each having a height of 8 a61732e808672c Javier Martinez Canillas 2022-02-14 367 * pixels, and the width of the screen. When sending a byte of a61732e808672c Javier Martinez Canillas 2022-02-14 368 * data to the controller, it gives the 8 bits for the current a61732e808672c Javier Martinez Canillas 2022-02-14 369 * column. I.e, the first byte are the 8 bits of the first a61732e808672c Javier Martinez Canillas 2022-02-14 370 * column, then the 8 bits for the second column, etc. a61732e808672c Javier Martinez Canillas 2022-02-14 371 * a61732e808672c Javier Martinez Canillas 2022-02-14 372 * a61732e808672c Javier Martinez Canillas 2022-02-14 373 * Representation of the screen, assuming it is 5 bits a61732e808672c Javier Martinez Canillas 2022-02-14 374 * wide. Each letter-number combination is a bit that controls a61732e808672c Javier Martinez Canillas 2022-02-14 375 * one pixel. a61732e808672c Javier Martinez Canillas 2022-02-14 376 * a61732e808672c Javier Martinez Canillas 2022-02-14 377 * A0 A1 A2 A3 A4 a61732e808672c Javier Martinez Canillas 2022-02-14 378 * B0 B1 B2 B3 B4 a61732e808672c Javier Martinez Canillas 2022-02-14 379 * C0 C1 C2 C3 C4 a61732e808672c Javier Martinez Canillas 2022-02-14 380 * D0 D1 D2 D3 D4 a61732e808672c Javier Martinez Canillas 2022-02-14 381 * E0 E1 E2 E3 E4