All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  9:17 ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2020-04-27  9:17 UTC (permalink / raw)
  To: Bernard Zhao, dri-devel, linux-arm-kernel, linux-mediatek
  Cc: linux-kernel, opensource.kernel, Chun-Kuang Hu, Daniel Vetter,
	David Airlie, Matthias Brugger, Philipp Zabel

> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

I find it safer to handle also such source code adjustments
by a small patch series together with improved commit messages.

Regards,
Markus

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  9:17 ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2020-04-27  9:17 UTC (permalink / raw)
  To: Bernard Zhao, dri-devel, linux-arm-kernel, linux-mediatek
  Cc: opensource.kernel, Philipp Zabel, Chun-Kuang Hu, David Airlie,
	linux-kernel, Daniel Vetter, Matthias Brugger

> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

I find it safer to handle also such source code adjustments
by a small patch series together with improved commit messages.

Regards,
Markus

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  9:17 ` Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: Markus Elfring @ 2020-04-27  9:17 UTC (permalink / raw)
  To: Bernard Zhao, dri-devel, linux-arm-kernel, linux-mediatek
  Cc: opensource.kernel, Chun-Kuang Hu, David Airlie, linux-kernel,
	Matthias Brugger

> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

I find it safer to handle also such source code adjustments
by a small patch series together with improved commit messages.

Regards,
Markus
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
  2020-04-27  7:52 ` Bernard Zhao
                     ` (2 preceding siblings ...)
  (?)
@ 2020-05-01  3:57   ` kbuild test robot
  -1 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-05-01  3:57 UTC (permalink / raw)
  To: Bernard Zhao, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-arm-kernel,
	linux-mediatek, linux-kernel, opensource.kernel
  Cc: kbuild-all, opensource.kernel

[-- Attachment #1: Type: text/plain, Size: 6273 bytes --]

Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.7-rc3 next-20200430]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-mediatek-cleanup-coding-style-in-mediatek-a-bit/20200428-055750
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_hdmi.c: In function 'mtk_hdmi_hw_send_info_frame':
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:1807: error: unterminated argument list invoking macro "dev_err"
    1807 | MODULE_LICENSE("GPL v2");
         | 
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'?
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
         |   _dev_err
   drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:10: error: expected ';' at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |          ^
         |          ;
   ......
    1807 | MODULE_LICENSE("GPL v2");
         |           
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
   drivers/gpu/drm/mediatek/mtk_hdmi.c:308:6: warning: unused variable 'ctrl_frame_en' [-Wunused-variable]
     308 |  int ctrl_frame_en = 0;
         |      ^~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:302:6: warning: unused variable 'i' [-Wunused-variable]
     302 |  int i;
         |      ^
   drivers/gpu/drm/mediatek/mtk_hdmi.c:301:6: warning: unused variable 'ctrl_reg' [-Wunused-variable]
     301 |  u32 ctrl_reg = GRL_CTRL;
         |      ^~~~~~~~
   At top level:
   drivers/gpu/drm/mediatek/mtk_hdmi.c:298:13: warning: 'mtk_hdmi_hw_send_info_frame' defined but not used [-Wunused-function]
     298 | static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:293:13: warning: 'mtk_hdmi_hw_enable_dvi_mode' defined but not used [-Wunused-function]
     293 | static void mtk_hdmi_hw_enable_dvi_mode(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:288:13: warning: 'mtk_hdmi_hw_write_int_mask' defined but not used [-Wunused-function]
     288 | static void mtk_hdmi_hw_write_int_mask(struct mtk_hdmi *hdmi, u32 int_mask)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:282:13: warning: 'mtk_hdmi_hw_enable_notice' defined but not used [-Wunused-function]
     282 | static void mtk_hdmi_hw_enable_notice(struct mtk_hdmi *hdmi, bool enable_notice)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:271:13: warning: 'mtk_hdmi_hw_reset' defined but not used [-Wunused-function]
     271 | static void mtk_hdmi_hw_reset(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:266:13: warning: 'mtk_hdmi_hw_aud_unmute' defined but not used [-Wunused-function]
     266 | static void mtk_hdmi_hw_aud_unmute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:261:13: warning: 'mtk_hdmi_hw_aud_mute' defined but not used [-Wunused-function]
     261 | static void mtk_hdmi_hw_aud_mute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:255:13: warning: 'mtk_hdmi_hw_1p4_version_enable' defined but not used [-Wunused-function]
     255 | static void mtk_hdmi_hw_1p4_version_enable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:230:13: warning: 'mtk_hdmi_hw_make_reg_writable' defined but not used [-Wunused-function]
     230 | static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:224:13: warning: 'mtk_hdmi_hw_vid_black' defined but not used [-Wunused-function]
     224 | static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:184:12: warning: 'mtk_hdmi_read' defined but not used [-Wunused-function]
     184 | static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
         |            ^~~~~~~~~~~~~

vim +/dev_err +1807 drivers/gpu/drm/mediatek/mtk_hdmi.c

8f83f26891e1257 Jie Qiu 2016-01-04  1804  
8f83f26891e1257 Jie Qiu 2016-01-04  1805  MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
8f83f26891e1257 Jie Qiu 2016-01-04  1806  MODULE_DESCRIPTION("MediaTek HDMI Driver");
8f83f26891e1257 Jie Qiu 2016-01-04 @1807  MODULE_LICENSE("GPL v2");

:::::: The code at line 1807 was first introduced by commit
:::::: 8f83f26891e12570780dcfc8ae376b655915ff6d drm/mediatek: Add HDMI support

:::::: TO: Jie Qiu <jie.qiu@mediatek.com>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 70706 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-05-01  3:57   ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-05-01  3:57 UTC (permalink / raw)
  To: Bernard Zhao, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-arm-kernel,
	linux-mediatek, linux-kernel, opensource.kernel
  Cc: opensource.kernel, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6273 bytes --]

Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.7-rc3 next-20200430]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-mediatek-cleanup-coding-style-in-mediatek-a-bit/20200428-055750
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_hdmi.c: In function 'mtk_hdmi_hw_send_info_frame':
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:1807: error: unterminated argument list invoking macro "dev_err"
    1807 | MODULE_LICENSE("GPL v2");
         | 
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'?
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
         |   _dev_err
   drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:10: error: expected ';' at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |          ^
         |          ;
   ......
    1807 | MODULE_LICENSE("GPL v2");
         |           
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
   drivers/gpu/drm/mediatek/mtk_hdmi.c:308:6: warning: unused variable 'ctrl_frame_en' [-Wunused-variable]
     308 |  int ctrl_frame_en = 0;
         |      ^~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:302:6: warning: unused variable 'i' [-Wunused-variable]
     302 |  int i;
         |      ^
   drivers/gpu/drm/mediatek/mtk_hdmi.c:301:6: warning: unused variable 'ctrl_reg' [-Wunused-variable]
     301 |  u32 ctrl_reg = GRL_CTRL;
         |      ^~~~~~~~
   At top level:
   drivers/gpu/drm/mediatek/mtk_hdmi.c:298:13: warning: 'mtk_hdmi_hw_send_info_frame' defined but not used [-Wunused-function]
     298 | static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:293:13: warning: 'mtk_hdmi_hw_enable_dvi_mode' defined but not used [-Wunused-function]
     293 | static void mtk_hdmi_hw_enable_dvi_mode(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:288:13: warning: 'mtk_hdmi_hw_write_int_mask' defined but not used [-Wunused-function]
     288 | static void mtk_hdmi_hw_write_int_mask(struct mtk_hdmi *hdmi, u32 int_mask)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:282:13: warning: 'mtk_hdmi_hw_enable_notice' defined but not used [-Wunused-function]
     282 | static void mtk_hdmi_hw_enable_notice(struct mtk_hdmi *hdmi, bool enable_notice)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:271:13: warning: 'mtk_hdmi_hw_reset' defined but not used [-Wunused-function]
     271 | static void mtk_hdmi_hw_reset(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:266:13: warning: 'mtk_hdmi_hw_aud_unmute' defined but not used [-Wunused-function]
     266 | static void mtk_hdmi_hw_aud_unmute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:261:13: warning: 'mtk_hdmi_hw_aud_mute' defined but not used [-Wunused-function]
     261 | static void mtk_hdmi_hw_aud_mute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:255:13: warning: 'mtk_hdmi_hw_1p4_version_enable' defined but not used [-Wunused-function]
     255 | static void mtk_hdmi_hw_1p4_version_enable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:230:13: warning: 'mtk_hdmi_hw_make_reg_writable' defined but not used [-Wunused-function]
     230 | static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:224:13: warning: 'mtk_hdmi_hw_vid_black' defined but not used [-Wunused-function]
     224 | static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:184:12: warning: 'mtk_hdmi_read' defined but not used [-Wunused-function]
     184 | static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
         |            ^~~~~~~~~~~~~

vim +/dev_err +1807 drivers/gpu/drm/mediatek/mtk_hdmi.c

8f83f26891e1257 Jie Qiu 2016-01-04  1804  
8f83f26891e1257 Jie Qiu 2016-01-04  1805  MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
8f83f26891e1257 Jie Qiu 2016-01-04  1806  MODULE_DESCRIPTION("MediaTek HDMI Driver");
8f83f26891e1257 Jie Qiu 2016-01-04 @1807  MODULE_LICENSE("GPL v2");

:::::: The code at line 1807 was first introduced by commit
:::::: 8f83f26891e12570780dcfc8ae376b655915ff6d drm/mediatek: Add HDMI support

:::::: TO: Jie Qiu <jie.qiu@mediatek.com>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 70706 bytes --]

[-- Attachment #3: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-05-01  3:57   ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-05-01  3:57 UTC (permalink / raw)
  To: Bernard Zhao, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-arm-kernel,
	linux-mediatek, linux-kernel, opensource.kernel
  Cc: opensource.kernel, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6273 bytes --]

Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.7-rc3 next-20200430]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-mediatek-cleanup-coding-style-in-mediatek-a-bit/20200428-055750
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_hdmi.c: In function 'mtk_hdmi_hw_send_info_frame':
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:1807: error: unterminated argument list invoking macro "dev_err"
    1807 | MODULE_LICENSE("GPL v2");
         | 
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'?
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
         |   _dev_err
   drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:10: error: expected ';' at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |          ^
         |          ;
   ......
    1807 | MODULE_LICENSE("GPL v2");
         |           
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
   drivers/gpu/drm/mediatek/mtk_hdmi.c:308:6: warning: unused variable 'ctrl_frame_en' [-Wunused-variable]
     308 |  int ctrl_frame_en = 0;
         |      ^~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:302:6: warning: unused variable 'i' [-Wunused-variable]
     302 |  int i;
         |      ^
   drivers/gpu/drm/mediatek/mtk_hdmi.c:301:6: warning: unused variable 'ctrl_reg' [-Wunused-variable]
     301 |  u32 ctrl_reg = GRL_CTRL;
         |      ^~~~~~~~
   At top level:
   drivers/gpu/drm/mediatek/mtk_hdmi.c:298:13: warning: 'mtk_hdmi_hw_send_info_frame' defined but not used [-Wunused-function]
     298 | static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:293:13: warning: 'mtk_hdmi_hw_enable_dvi_mode' defined but not used [-Wunused-function]
     293 | static void mtk_hdmi_hw_enable_dvi_mode(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:288:13: warning: 'mtk_hdmi_hw_write_int_mask' defined but not used [-Wunused-function]
     288 | static void mtk_hdmi_hw_write_int_mask(struct mtk_hdmi *hdmi, u32 int_mask)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:282:13: warning: 'mtk_hdmi_hw_enable_notice' defined but not used [-Wunused-function]
     282 | static void mtk_hdmi_hw_enable_notice(struct mtk_hdmi *hdmi, bool enable_notice)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:271:13: warning: 'mtk_hdmi_hw_reset' defined but not used [-Wunused-function]
     271 | static void mtk_hdmi_hw_reset(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:266:13: warning: 'mtk_hdmi_hw_aud_unmute' defined but not used [-Wunused-function]
     266 | static void mtk_hdmi_hw_aud_unmute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:261:13: warning: 'mtk_hdmi_hw_aud_mute' defined but not used [-Wunused-function]
     261 | static void mtk_hdmi_hw_aud_mute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:255:13: warning: 'mtk_hdmi_hw_1p4_version_enable' defined but not used [-Wunused-function]
     255 | static void mtk_hdmi_hw_1p4_version_enable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:230:13: warning: 'mtk_hdmi_hw_make_reg_writable' defined but not used [-Wunused-function]
     230 | static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:224:13: warning: 'mtk_hdmi_hw_vid_black' defined but not used [-Wunused-function]
     224 | static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:184:12: warning: 'mtk_hdmi_read' defined but not used [-Wunused-function]
     184 | static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
         |            ^~~~~~~~~~~~~

vim +/dev_err +1807 drivers/gpu/drm/mediatek/mtk_hdmi.c

8f83f26891e1257 Jie Qiu 2016-01-04  1804  
8f83f26891e1257 Jie Qiu 2016-01-04  1805  MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
8f83f26891e1257 Jie Qiu 2016-01-04  1806  MODULE_DESCRIPTION("MediaTek HDMI Driver");
8f83f26891e1257 Jie Qiu 2016-01-04 @1807  MODULE_LICENSE("GPL v2");

:::::: The code at line 1807 was first introduced by commit
:::::: 8f83f26891e12570780dcfc8ae376b655915ff6d drm/mediatek: Add HDMI support

:::::: TO: Jie Qiu <jie.qiu@mediatek.com>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 70706 bytes --]

[-- Attachment #3: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-05-01  3:57   ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-05-01  3:57 UTC (permalink / raw)
  To: Bernard Zhao, Chun-Kuang Hu, Philipp Zabel, David Airlie,
	Daniel Vetter, Matthias Brugger, dri-devel, linux-arm-kernel,
	linux-mediatek, linux-kernel, opensource.kernel
  Cc: opensource.kernel, kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6273 bytes --]

Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.7-rc3 next-20200430]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-mediatek-cleanup-coding-style-in-mediatek-a-bit/20200428-055750
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_hdmi.c: In function 'mtk_hdmi_hw_send_info_frame':
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:1807: error: unterminated argument list invoking macro "dev_err"
    1807 | MODULE_LICENSE("GPL v2");
         | 
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'?
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
         |   _dev_err
   drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:10: error: expected ';' at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |          ^
         |          ;
   ......
    1807 | MODULE_LICENSE("GPL v2");
         |           
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
   drivers/gpu/drm/mediatek/mtk_hdmi.c:308:6: warning: unused variable 'ctrl_frame_en' [-Wunused-variable]
     308 |  int ctrl_frame_en = 0;
         |      ^~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:302:6: warning: unused variable 'i' [-Wunused-variable]
     302 |  int i;
         |      ^
   drivers/gpu/drm/mediatek/mtk_hdmi.c:301:6: warning: unused variable 'ctrl_reg' [-Wunused-variable]
     301 |  u32 ctrl_reg = GRL_CTRL;
         |      ^~~~~~~~
   At top level:
   drivers/gpu/drm/mediatek/mtk_hdmi.c:298:13: warning: 'mtk_hdmi_hw_send_info_frame' defined but not used [-Wunused-function]
     298 | static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:293:13: warning: 'mtk_hdmi_hw_enable_dvi_mode' defined but not used [-Wunused-function]
     293 | static void mtk_hdmi_hw_enable_dvi_mode(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:288:13: warning: 'mtk_hdmi_hw_write_int_mask' defined but not used [-Wunused-function]
     288 | static void mtk_hdmi_hw_write_int_mask(struct mtk_hdmi *hdmi, u32 int_mask)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:282:13: warning: 'mtk_hdmi_hw_enable_notice' defined but not used [-Wunused-function]
     282 | static void mtk_hdmi_hw_enable_notice(struct mtk_hdmi *hdmi, bool enable_notice)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:271:13: warning: 'mtk_hdmi_hw_reset' defined but not used [-Wunused-function]
     271 | static void mtk_hdmi_hw_reset(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:266:13: warning: 'mtk_hdmi_hw_aud_unmute' defined but not used [-Wunused-function]
     266 | static void mtk_hdmi_hw_aud_unmute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:261:13: warning: 'mtk_hdmi_hw_aud_mute' defined but not used [-Wunused-function]
     261 | static void mtk_hdmi_hw_aud_mute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:255:13: warning: 'mtk_hdmi_hw_1p4_version_enable' defined but not used [-Wunused-function]
     255 | static void mtk_hdmi_hw_1p4_version_enable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:230:13: warning: 'mtk_hdmi_hw_make_reg_writable' defined but not used [-Wunused-function]
     230 | static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:224:13: warning: 'mtk_hdmi_hw_vid_black' defined but not used [-Wunused-function]
     224 | static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:184:12: warning: 'mtk_hdmi_read' defined but not used [-Wunused-function]
     184 | static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
         |            ^~~~~~~~~~~~~

vim +/dev_err +1807 drivers/gpu/drm/mediatek/mtk_hdmi.c

8f83f26891e1257 Jie Qiu 2016-01-04  1804  
8f83f26891e1257 Jie Qiu 2016-01-04  1805  MODULE_AUTHOR("Jie Qiu <jie.qiu@mediatek.com>");
8f83f26891e1257 Jie Qiu 2016-01-04  1806  MODULE_DESCRIPTION("MediaTek HDMI Driver");
8f83f26891e1257 Jie Qiu 2016-01-04 @1807  MODULE_LICENSE("GPL v2");

:::::: The code at line 1807 was first introduced by commit
:::::: 8f83f26891e12570780dcfc8ae376b655915ff6d drm/mediatek: Add HDMI support

:::::: TO: Jie Qiu <jie.qiu@mediatek.com>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 70706 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-05-01  3:57   ` kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-05-01  3:57 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6382 bytes --]

Hi Bernard,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on pza/reset/next]
[also build test ERROR on drm-intel/for-linux-next drm-tip/drm-tip linus/master v5.7-rc3 next-20200430]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Bernard-Zhao/drm-mediatek-cleanup-coding-style-in-mediatek-a-bit/20200428-055750
base:   https://git.pengutronix.de/git/pza/linux reset/next
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/mediatek/mtk_hdmi.c: In function 'mtk_hdmi_hw_send_info_frame':
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:1807: error: unterminated argument list invoking macro "dev_err"
    1807 | MODULE_LICENSE("GPL v2");
         | 
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: 'dev_err' undeclared (first use in this function); did you mean '_dev_err'?
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
         |   _dev_err
   drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:10: error: expected ';' at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |          ^
         |          ;
   ......
    1807 | MODULE_LICENSE("GPL v2");
         |           
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
     316 |   dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
         |   ^~~~~~~
>> drivers/gpu/drm/mediatek/mtk_hdmi.c:316:3: error: expected declaration or statement at end of input
   drivers/gpu/drm/mediatek/mtk_hdmi.c:308:6: warning: unused variable 'ctrl_frame_en' [-Wunused-variable]
     308 |  int ctrl_frame_en = 0;
         |      ^~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:302:6: warning: unused variable 'i' [-Wunused-variable]
     302 |  int i;
         |      ^
   drivers/gpu/drm/mediatek/mtk_hdmi.c:301:6: warning: unused variable 'ctrl_reg' [-Wunused-variable]
     301 |  u32 ctrl_reg = GRL_CTRL;
         |      ^~~~~~~~
   At top level:
   drivers/gpu/drm/mediatek/mtk_hdmi.c:298:13: warning: 'mtk_hdmi_hw_send_info_frame' defined but not used [-Wunused-function]
     298 | static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:293:13: warning: 'mtk_hdmi_hw_enable_dvi_mode' defined but not used [-Wunused-function]
     293 | static void mtk_hdmi_hw_enable_dvi_mode(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:288:13: warning: 'mtk_hdmi_hw_write_int_mask' defined but not used [-Wunused-function]
     288 | static void mtk_hdmi_hw_write_int_mask(struct mtk_hdmi *hdmi, u32 int_mask)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:282:13: warning: 'mtk_hdmi_hw_enable_notice' defined but not used [-Wunused-function]
     282 | static void mtk_hdmi_hw_enable_notice(struct mtk_hdmi *hdmi, bool enable_notice)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:271:13: warning: 'mtk_hdmi_hw_reset' defined but not used [-Wunused-function]
     271 | static void mtk_hdmi_hw_reset(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:266:13: warning: 'mtk_hdmi_hw_aud_unmute' defined but not used [-Wunused-function]
     266 | static void mtk_hdmi_hw_aud_unmute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:261:13: warning: 'mtk_hdmi_hw_aud_mute' defined but not used [-Wunused-function]
     261 | static void mtk_hdmi_hw_aud_mute(struct mtk_hdmi *hdmi)
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:255:13: warning: 'mtk_hdmi_hw_1p4_version_enable' defined but not used [-Wunused-function]
     255 | static void mtk_hdmi_hw_1p4_version_enable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:230:13: warning: 'mtk_hdmi_hw_make_reg_writable' defined but not used [-Wunused-function]
     230 | static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:224:13: warning: 'mtk_hdmi_hw_vid_black' defined but not used [-Wunused-function]
     224 | static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
         |             ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/mediatek/mtk_hdmi.c:184:12: warning: 'mtk_hdmi_read' defined but not used [-Wunused-function]
     184 | static u32 mtk_hdmi_read(struct mtk_hdmi *hdmi, u32 offset)
         |            ^~~~~~~~~~~~~

vim +/dev_err +1807 drivers/gpu/drm/mediatek/mtk_hdmi.c

8f83f26891e1257 Jie Qiu 2016-01-04  1804  
8f83f26891e1257 Jie Qiu 2016-01-04  1805  MODULE_AUTHOR("Jie Qiu <jie.qiu(a)mediatek.com>");
8f83f26891e1257 Jie Qiu 2016-01-04  1806  MODULE_DESCRIPTION("MediaTek HDMI Driver");
8f83f26891e1257 Jie Qiu 2016-01-04 @1807  MODULE_LICENSE("GPL v2");

:::::: The code at line 1807 was first introduced by commit
:::::: 8f83f26891e12570780dcfc8ae376b655915ff6d drm/mediatek: Add HDMI support

:::::: TO: Jie Qiu <jie.qiu@mediatek.com>
:::::: CC: Philipp Zabel <p.zabel@pengutronix.de>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70706 bytes --]

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
  2020-04-27  7:52 ` Bernard Zhao
  (?)
  (?)
@ 2020-04-29 14:22   ` Chun-Kuang Hu
  -1 siblings, 0 replies; 16+ messages in thread
From: Chun-Kuang Hu @ 2020-04-29 14:22 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, DRI Development, Linux ARM,
	moderated list:ARM/Mediatek SoC support, linux-kernel,
	opensource.kernel

Hi, Bernard:

Bernard Zhao <bernard@vivo.com> 於 2020年4月27日 週一 下午3:53寫道:
>
> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

One patch should just do one thing, but this do three things.
So break this into three patches.

Regards,
Chun-Kuang.

>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..40fb5154ed5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
>         u8 checksum;
>         int ctrl_frame_en = 0;
>
> -       frame_type = *buffer;
> -       buffer += 1;
> -       frame_ver = *buffer;
> -       buffer += 1;
> -       frame_len = *buffer;
> -       buffer += 1;
> -       checksum = *buffer;
> -       buffer += 1;
> +       frame_type = *buffer++;
> +       frame_ver = *buffer++;
> +       frame_len = *buffer++;
> +       checksum = *buffer++;
>         frame_data = buffer;
> +       if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> +               dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> +               return;
> +       }
>
>         dev_dbg(hdmi->dev,
>                 "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
>                                         struct drm_display_mode *mode)
>  {
>         struct hdmi_avi_infoframe frame;
> -       u8 buffer[17];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>                                         const char *product)
>  {
>         struct hdmi_spd_infoframe frame;
> -       u8 buffer[29];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_spd_infoframe_init(&frame, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
>         struct hdmi_audio_infoframe frame;
> -       u8 buffer[14];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_audio_infoframe_init(&frame);
> --
> 2.26.2
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-29 14:22   ` Chun-Kuang Hu
  0 siblings, 0 replies; 16+ messages in thread
From: Chun-Kuang Hu @ 2020-04-29 14:22 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Chun-Kuang Hu, Philipp Zabel, opensource.kernel, David Airlie,
	linux-kernel, DRI Development,
	moderated list:ARM/Mediatek SoC support, Daniel Vetter,
	Matthias Brugger, Linux ARM

Hi, Bernard:

Bernard Zhao <bernard@vivo.com> 於 2020年4月27日 週一 下午3:53寫道:
>
> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

One patch should just do one thing, but this do three things.
So break this into three patches.

Regards,
Chun-Kuang.

>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..40fb5154ed5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
>         u8 checksum;
>         int ctrl_frame_en = 0;
>
> -       frame_type = *buffer;
> -       buffer += 1;
> -       frame_ver = *buffer;
> -       buffer += 1;
> -       frame_len = *buffer;
> -       buffer += 1;
> -       checksum = *buffer;
> -       buffer += 1;
> +       frame_type = *buffer++;
> +       frame_ver = *buffer++;
> +       frame_len = *buffer++;
> +       checksum = *buffer++;
>         frame_data = buffer;
> +       if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> +               dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> +               return;
> +       }
>
>         dev_dbg(hdmi->dev,
>                 "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
>                                         struct drm_display_mode *mode)
>  {
>         struct hdmi_avi_infoframe frame;
> -       u8 buffer[17];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>                                         const char *product)
>  {
>         struct hdmi_spd_infoframe frame;
> -       u8 buffer[29];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_spd_infoframe_init(&frame, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
>         struct hdmi_audio_infoframe frame;
> -       u8 buffer[14];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_audio_infoframe_init(&frame);
> --
> 2.26.2
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-29 14:22   ` Chun-Kuang Hu
  0 siblings, 0 replies; 16+ messages in thread
From: Chun-Kuang Hu @ 2020-04-29 14:22 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Chun-Kuang Hu, Philipp Zabel, opensource.kernel, David Airlie,
	linux-kernel, DRI Development,
	moderated list:ARM/Mediatek SoC support, Daniel Vetter,
	Matthias Brugger, Linux ARM

Hi, Bernard:

Bernard Zhao <bernard@vivo.com> 於 2020年4月27日 週一 下午3:53寫道:
>
> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

One patch should just do one thing, but this do three things.
So break this into three patches.

Regards,
Chun-Kuang.

>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..40fb5154ed5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
>         u8 checksum;
>         int ctrl_frame_en = 0;
>
> -       frame_type = *buffer;
> -       buffer += 1;
> -       frame_ver = *buffer;
> -       buffer += 1;
> -       frame_len = *buffer;
> -       buffer += 1;
> -       checksum = *buffer;
> -       buffer += 1;
> +       frame_type = *buffer++;
> +       frame_ver = *buffer++;
> +       frame_len = *buffer++;
> +       checksum = *buffer++;
>         frame_data = buffer;
> +       if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> +               dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> +               return;
> +       }
>
>         dev_dbg(hdmi->dev,
>                 "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
>                                         struct drm_display_mode *mode)
>  {
>         struct hdmi_avi_infoframe frame;
> -       u8 buffer[17];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>                                         const char *product)
>  {
>         struct hdmi_spd_infoframe frame;
> -       u8 buffer[29];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_spd_infoframe_init(&frame, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
>         struct hdmi_audio_infoframe frame;
> -       u8 buffer[14];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_audio_infoframe_init(&frame);
> --
> 2.26.2
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-29 14:22   ` Chun-Kuang Hu
  0 siblings, 0 replies; 16+ messages in thread
From: Chun-Kuang Hu @ 2020-04-29 14:22 UTC (permalink / raw)
  To: Bernard Zhao
  Cc: Chun-Kuang Hu, opensource.kernel, David Airlie, linux-kernel,
	DRI Development, moderated list:ARM/Mediatek SoC support,
	Matthias Brugger, Linux ARM

Hi, Bernard:

Bernard Zhao <bernard@vivo.com> 於 2020年4月27日 週一 下午3:53寫道:
>
> This code change is to make code bit more readable.
> Optimise array size align to HDMI macro define.
> Add check if len is overange.

One patch should just do one thing, but this do three things.
So break this into three patches.

Regards,
Chun-Kuang.

>
> Signed-off-by: Bernard Zhao <bernard@vivo.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index ff43a3d80410..40fb5154ed5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
>         u8 checksum;
>         int ctrl_frame_en = 0;
>
> -       frame_type = *buffer;
> -       buffer += 1;
> -       frame_ver = *buffer;
> -       buffer += 1;
> -       frame_len = *buffer;
> -       buffer += 1;
> -       checksum = *buffer;
> -       buffer += 1;
> +       frame_type = *buffer++;
> +       frame_ver = *buffer++;
> +       frame_len = *buffer++;
> +       checksum = *buffer++;
>         frame_data = buffer;
> +       if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
> +               dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
> +               return;
> +       }
>
>         dev_dbg(hdmi->dev,
>                 "frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
> @@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
>                                         struct drm_display_mode *mode)
>  {
>         struct hdmi_avi_infoframe frame;
> -       u8 buffer[17];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
> @@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>                                         const char *product)
>  {
>         struct hdmi_spd_infoframe frame;
> -       u8 buffer[29];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_spd_infoframe_init(&frame, vendor, product);
> @@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
>  static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
>  {
>         struct hdmi_audio_infoframe frame;
> -       u8 buffer[14];
> +       u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
>         ssize_t err;
>
>         err = hdmi_audio_infoframe_init(&frame);
> --
> 2.26.2
>
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  7:52 ` Bernard Zhao
  0 siblings, 0 replies; 16+ messages in thread
From: Bernard Zhao @ 2020-04-27  7:52 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

This code change is to make code bit more readable.
Optimise array size align to HDMI macro define.
Add check if len is overange.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ff43a3d80410..40fb5154ed5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
 	u8 checksum;
 	int ctrl_frame_en = 0;
 
-	frame_type = *buffer;
-	buffer += 1;
-	frame_ver = *buffer;
-	buffer += 1;
-	frame_len = *buffer;
-	buffer += 1;
-	checksum = *buffer;
-	buffer += 1;
+	frame_type = *buffer++;
+	frame_ver = *buffer++;
+	frame_len = *buffer++;
+	checksum = *buffer++;
 	frame_data = buffer;
+	if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
+		dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
+		return;
+	}
 
 	dev_dbg(hdmi->dev,
 		"frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
@@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 					struct drm_display_mode *mode)
 {
 	struct hdmi_avi_infoframe frame;
-	u8 buffer[17];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
@@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 					const char *product)
 {
 	struct hdmi_spd_infoframe frame;
-	u8 buffer[29];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_spd_infoframe_init(&frame, vendor, product);
@@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
 {
 	struct hdmi_audio_infoframe frame;
-	u8 buffer[14];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_audio_infoframe_init(&frame);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  7:52 ` Bernard Zhao
  0 siblings, 0 replies; 16+ messages in thread
From: Bernard Zhao @ 2020-04-27  7:52 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

This code change is to make code bit more readable.
Optimise array size align to HDMI macro define.
Add check if len is overange.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ff43a3d80410..40fb5154ed5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
 	u8 checksum;
 	int ctrl_frame_en = 0;
 
-	frame_type = *buffer;
-	buffer += 1;
-	frame_ver = *buffer;
-	buffer += 1;
-	frame_len = *buffer;
-	buffer += 1;
-	checksum = *buffer;
-	buffer += 1;
+	frame_type = *buffer++;
+	frame_ver = *buffer++;
+	frame_len = *buffer++;
+	checksum = *buffer++;
 	frame_data = buffer;
+	if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
+		dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
+		return;
+	}
 
 	dev_dbg(hdmi->dev,
 		"frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
@@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 					struct drm_display_mode *mode)
 {
 	struct hdmi_avi_infoframe frame;
-	u8 buffer[17];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
@@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 					const char *product)
 {
 	struct hdmi_spd_infoframe frame;
-	u8 buffer[29];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_spd_infoframe_init(&frame, vendor, product);
@@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
 {
 	struct hdmi_audio_infoframe frame;
-	u8 buffer[14];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_audio_infoframe_init(&frame);
-- 
2.26.2


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  7:52 ` Bernard Zhao
  0 siblings, 0 replies; 16+ messages in thread
From: Bernard Zhao @ 2020-04-27  7:52 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

This code change is to make code bit more readable.
Optimise array size align to HDMI macro define.
Add check if len is overange.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ff43a3d80410..40fb5154ed5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
 	u8 checksum;
 	int ctrl_frame_en = 0;
 
-	frame_type = *buffer;
-	buffer += 1;
-	frame_ver = *buffer;
-	buffer += 1;
-	frame_len = *buffer;
-	buffer += 1;
-	checksum = *buffer;
-	buffer += 1;
+	frame_type = *buffer++;
+	frame_ver = *buffer++;
+	frame_len = *buffer++;
+	checksum = *buffer++;
 	frame_data = buffer;
+	if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
+		dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
+		return;
+	}
 
 	dev_dbg(hdmi->dev,
 		"frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
@@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 					struct drm_display_mode *mode)
 {
 	struct hdmi_avi_infoframe frame;
-	u8 buffer[17];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
@@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 					const char *product)
 {
 	struct hdmi_spd_infoframe frame;
-	u8 buffer[29];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_spd_infoframe_init(&frame, vendor, product);
@@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
 {
 	struct hdmi_audio_infoframe frame;
-	u8 buffer[14];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_audio_infoframe_init(&frame);
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH] drm/mediatek: cleanup coding style in mediatek a bit
@ 2020-04-27  7:52 ` Bernard Zhao
  0 siblings, 0 replies; 16+ messages in thread
From: Bernard Zhao @ 2020-04-27  7:52 UTC (permalink / raw)
  To: Chun-Kuang Hu, Philipp Zabel, David Airlie, Daniel Vetter,
	Matthias Brugger, dri-devel, linux-arm-kernel, linux-mediatek,
	linux-kernel
  Cc: opensource.kernel, Bernard Zhao

This code change is to make code bit more readable.
Optimise array size align to HDMI macro define.
Add check if len is overange.

Signed-off-by: Bernard Zhao <bernard@vivo.com>
---
 drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
index ff43a3d80410..40fb5154ed5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
@@ -311,15 +311,15 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,
 	u8 checksum;
 	int ctrl_frame_en = 0;
 
-	frame_type = *buffer;
-	buffer += 1;
-	frame_ver = *buffer;
-	buffer += 1;
-	frame_len = *buffer;
-	buffer += 1;
-	checksum = *buffer;
-	buffer += 1;
+	frame_type = *buffer++;
+	frame_ver = *buffer++;
+	frame_len = *buffer++;
+	checksum = *buffer++;
 	frame_data = buffer;
+	if ((frame_len + HDMI_INFOFRAME_HEADER_SIZE) > len) {
+		dev_err(hdmi->dev, "Wrong frame len: %d\n", frame_len;
+		return;
+	}
 
 	dev_dbg(hdmi->dev,
 		"frame_type:0x%x,frame_ver:0x%x,frame_len:0x%x,checksum:0x%x\n",
@@ -982,7 +982,7 @@ static int mtk_hdmi_setup_avi_infoframe(struct mtk_hdmi *hdmi,
 					struct drm_display_mode *mode)
 {
 	struct hdmi_avi_infoframe frame;
-	u8 buffer[17];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AVI_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = drm_hdmi_avi_infoframe_from_display_mode(&frame,
@@ -1008,7 +1008,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 					const char *product)
 {
 	struct hdmi_spd_infoframe frame;
-	u8 buffer[29];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_SPD_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_spd_infoframe_init(&frame, vendor, product);
@@ -1031,7 +1031,7 @@ static int mtk_hdmi_setup_spd_infoframe(struct mtk_hdmi *hdmi,
 static int mtk_hdmi_setup_audio_infoframe(struct mtk_hdmi *hdmi)
 {
 	struct hdmi_audio_infoframe frame;
-	u8 buffer[14];
+	u8 buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
 	ssize_t err;
 
 	err = hdmi_audio_infoframe_init(&frame);
-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-05-16 15:41 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-27  9:17 [PATCH] drm/mediatek: cleanup coding style in mediatek a bit Markus Elfring
2020-04-27  9:17 ` Markus Elfring
2020-04-27  9:17 ` Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-04-27  7:52 Bernard Zhao
2020-04-27  7:52 ` Bernard Zhao
2020-04-27  7:52 ` Bernard Zhao
2020-04-27  7:52 ` Bernard Zhao
2020-04-29 14:22 ` Chun-Kuang Hu
2020-04-29 14:22   ` Chun-Kuang Hu
2020-04-29 14:22   ` Chun-Kuang Hu
2020-04-29 14:22   ` Chun-Kuang Hu
2020-05-01  3:57 ` kbuild test robot
2020-05-01  3:57   ` kbuild test robot
2020-05-01  3:57   ` kbuild test robot
2020-05-01  3:57   ` kbuild test robot
2020-05-01  3:57   ` kbuild test robot

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.