diff mbox series

[v4,1/5] Bluetooth: btmtk: add the function to get the fw name

Message ID 965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang@kernel.org (mailing list archive)
State Superseded
Headers show
Series [v4,1/5] Bluetooth: btmtk: add the function to get the fw name | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning warning CheckSparse WARNING drivers/bluetooth/btmtk.c: In function ‘btmtk_fw_get_filename’:drivers/bluetooth/btmtk.c:115:14: warning: ‘mediatek/BT_RAM_CODE_MT’ directive output truncated writing 23 bytes into a region of size 8 [-Wformat-truncation=] 115 | "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin", | ~~~~~~~~^~~~~~~~~~~~~~~drivers/bluetooth/btmtk.c:115:5: note: directive argument in the range [1, 256] 115 | "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/bluetooth/btmtk.c:114:3: note: ‘snprintf’ output between 41 and 43 bytes into a destination of size 8 114 | snprintf(buf, sizeof(size), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 115 | "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 116 | dev_id & 0xffff, (fw_ver & 0xff) + 1); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tedd_an/CheckSparse success CheckSparse PASS
tedd_an/CheckSmatch fail CheckSparse: FAIL: Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o' make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2 make[2]: *** Waiting for unfinished jobs.... Segmentation fault (core dumped) make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o' make[4]: *** Waiting for unfinished jobs.... make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2 make: *** [Makefile:240: __sub-make] Error 2
tedd_an/BuildKernel32 success BuildKernel32 PASS
tedd_an/TestRunnerSetup success TestRunnerSetup PASS
tedd_an/TestRunner_l2cap-tester success TestRunner PASS
tedd_an/TestRunner_iso-tester success TestRunner PASS
tedd_an/TestRunner_bnep-tester success TestRunner PASS
tedd_an/TestRunner_mgmt-tester success TestRunner PASS
tedd_an/TestRunner_rfcomm-tester success TestRunner PASS
tedd_an/TestRunner_sco-tester success TestRunner PASS
tedd_an/TestRunner_ioctl-tester success TestRunner PASS
tedd_an/TestRunner_mesh-tester success TestRunner PASS
tedd_an/TestRunner_smp-tester success TestRunner PASS
tedd_an/TestRunner_userchan-tester success TestRunner PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Sean Wang May 7, 2024, 7:21 p.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

Include a shared function to get the firmware name, to prevent repeating
code for similar chipsets.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
v3: first added to the series
v4: rebase onto the latest code and add an additional parameter
    fw_flavor into the function btmtk_fw_get_filename.
---
 drivers/bluetooth/btmtk.c | 18 ++++++++++++++++++
 drivers/bluetooth/btmtk.h |  8 ++++++++
 2 files changed, 26 insertions(+)

Comments

bluez.test.bot@gmail.com May 7, 2024, 7:56 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=851322

---Test result---

Test Summary:
CheckPatch                    PASS      3.55 seconds
GitLint                       FAIL      1.70 seconds
SubjectPrefix                 PASS      0.65 seconds
BuildKernel                   PASS      29.88 seconds
CheckAllWarning               WARNING   32.83 seconds
CheckSparse                   PASS      38.08 seconds
CheckSmatch                   FAIL      34.55 seconds
BuildKernel32                 PASS      28.70 seconds
TestRunnerSetup               PASS      515.72 seconds
TestRunner_l2cap-tester       PASS      18.32 seconds
TestRunner_iso-tester         PASS      31.15 seconds
TestRunner_bnep-tester        PASS      4.67 seconds
TestRunner_mgmt-tester        PASS      110.76 seconds
TestRunner_rfcomm-tester      PASS      7.20 seconds
TestRunner_sco-tester         PASS      14.99 seconds
TestRunner_ioctl-tester       PASS      7.70 seconds
TestRunner_mesh-tester        PASS      5.79 seconds
TestRunner_smp-tester         PASS      6.79 seconds
TestRunner_userchan-tester    PASS      4.89 seconds
IncrementalBuild              PASS      48.56 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v4,4/5] Bluetooth: btusb: mediatek: reset the controller before downloading the fw

WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
1: T1 Title exceeds max length (83>80): "[v4,4/5] Bluetooth: btusb: mediatek: reset the controller before downloading the fw"
##############################
Test: CheckAllWarning - WARNING
Desc: Run linux kernel with all warning enabled
Output:
drivers/bluetooth/btmtk.c: In function ‘btmtk_fw_get_filename’:drivers/bluetooth/btmtk.c:115:14: warning: ‘mediatek/BT_RAM_CODE_MT’ directive output truncated writing 23 bytes into a region of size 8 [-Wformat-truncation=]  115 |     "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",      |      ~~~~~~~~^~~~~~~~~~~~~~~drivers/bluetooth/btmtk.c:115:5: note: directive argument in the range [1, 256]  115 |     "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~drivers/bluetooth/btmtk.c:114:3: note: ‘snprintf’ output between 41 and 43 bytes into a destination of size 8  114 |   snprintf(buf, sizeof(size),      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~  115 |     "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  116 |     dev_id & 0xffff, (fw_ver & 0xff) + 1);      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139
make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139
make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[1]: *** [/github/workspace/src/src/Makefile:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2


---
Regards,
Linux Bluetooth
kernel test robot May 8, 2024, 7:12 a.m. UTC | #2
Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master linus/master v6.9-rc7 next-20240507]
[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/sean-wang-kernel-org/Bluetooth-btmtk-apply-the-common-btmtk_fw_get_filename/20240508-032333
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang%40kernel.org
patch subject: [PATCH v4 1/5] Bluetooth: btmtk: add the function to get the fw name
config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405081456.v2MvcQ0P-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/bluetooth/btmtk.c: In function 'btmtk_fw_get_filename':
>> drivers/bluetooth/btmtk.c:115:35: warning: 'mediatek/BT_RAM_CODE_MT' directive output truncated writing 23 bytes into a region of size 8 [-Wformat-truncation=]
     115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
         |                           ~~~~~~~~^~~~~~~~~~~~~~~
   drivers/bluetooth/btmtk.c:115:26: note: directive argument in the range [1, 256]
     115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/bluetooth/btmtk.c:114:17: note: 'snprintf' output between 41 and 43 bytes into a destination of size 8
     114 |                 snprintf(buf, sizeof(size),
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
     115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     116 |                          dev_id & 0xffff, (fw_ver & 0xff) + 1);
         |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +115 drivers/bluetooth/btmtk.c

   105	
   106	void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
   107				   u32 fw_flavor)
   108	{
   109		if (dev_id == 0x7925)
   110			snprintf(buf, size,
   111				 "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
   112				 dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
   113		else if (dev_id == 0x7961 && fw_flavor)
   114			snprintf(buf, sizeof(size),
 > 115				 "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
   116				 dev_id & 0xffff, (fw_ver & 0xff) + 1);
   117		else
   118			snprintf(buf, size,
   119				 "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
   120				 dev_id & 0xffff, (fw_ver & 0xff) + 1);
   121	}
   122	EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
   123
kernel test robot May 8, 2024, 11:22 a.m. UTC | #3
Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master linus/master v6.9-rc7 next-20240508]
[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/sean-wang-kernel-org/Bluetooth-btmtk-apply-the-common-btmtk_fw_get_filename/20240508-032333
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang%40kernel.org
patch subject: [PATCH v4 1/5] Bluetooth: btmtk: add the function to get the fw name
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20240508/202405081828.e6IMNKPn-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 0ab4458df0688955620b72cc2c72a32dffad3615)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405081828.e6IMNKPn-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405081828.e6IMNKPn-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/bluetooth/btmtk.c:8:
   In file included from include/net/bluetooth/bluetooth.h:30:
   In file included from include/net/sock.h:38:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     547 |         val = __raw_readb(PCI_IOBASE + addr);
         |                           ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     560 |         val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
      37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
         |                                                   ^
   In file included from drivers/bluetooth/btmtk.c:8:
   In file included from include/net/bluetooth/bluetooth.h:30:
   In file included from include/net/sock.h:38:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     573 |         val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
         |                                                         ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
      35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
         |                                                   ^
   In file included from drivers/bluetooth/btmtk.c:8:
   In file included from include/net/bluetooth/bluetooth.h:30:
   In file included from include/net/sock.h:38:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:328:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     584 |         __raw_writeb(value, PCI_IOBASE + addr);
         |                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     594 |         __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
     604 |         __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
         |                                                       ~~~~~~~~~~ ^
   In file included from drivers/bluetooth/btmtk.c:8:
   In file included from include/net/bluetooth/bluetooth.h:30:
   In file included from include/net/sock.h:46:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:10:
   In file included from include/linux/mm.h:2210:
   include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     522 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/bluetooth/btmtk.c:114:3: warning: 'snprintf' will always be truncated; specified size is 4, but format string expands to at least 41 [-Wformat-truncation]
     114 |                 snprintf(buf, sizeof(size),
         |                 ^
   8 warnings generated.


vim +/snprintf +114 drivers/bluetooth/btmtk.c

   105	
   106	void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
   107				   u32 fw_flavor)
   108	{
   109		if (dev_id == 0x7925)
   110			snprintf(buf, size,
   111				 "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
   112				 dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
   113		else if (dev_id == 0x7961 && fw_flavor)
 > 114			snprintf(buf, sizeof(size),
   115				 "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
   116				 dev_id & 0xffff, (fw_ver & 0xff) + 1);
   117		else
   118			snprintf(buf, size,
   119				 "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
   120				 dev_id & 0xffff, (fw_ver & 0xff) + 1);
   121	}
   122	EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
   123
Luiz Augusto von Dentz May 8, 2024, 2:37 p.m. UTC | #4
Hi Sean,

On Wed, May 8, 2024 at 3:13 AM kernel test robot <lkp@intel.com> wrote:
>
> Hi,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on bluetooth/master]
> [also build test WARNING on bluetooth-next/master linus/master v6.9-rc7 next-20240507]
> [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/sean-wang-kernel-org/Bluetooth-btmtk-apply-the-common-btmtk_fw_get_filename/20240508-032333
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
> patch link:    https://lore.kernel.org/r/965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang%40kernel.org
> patch subject: [PATCH v4 1/5] Bluetooth: btmtk: add the function to get the fw name
> config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 13.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202405081456.v2MvcQ0P-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
>    drivers/bluetooth/btmtk.c: In function 'btmtk_fw_get_filename':
> >> drivers/bluetooth/btmtk.c:115:35: warning: 'mediatek/BT_RAM_CODE_MT' directive output truncated writing 23 bytes into a region of size 8 [-Wformat-truncation=]
>      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
>          |                           ~~~~~~~~^~~~~~~~~~~~~~~
>    drivers/bluetooth/btmtk.c:115:26: note: directive argument in the range [1, 256]
>      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
>          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    drivers/bluetooth/btmtk.c:114:17: note: 'snprintf' output between 41 and 43 bytes into a destination of size 8
>      114 |                 snprintf(buf, sizeof(size),
>          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
>          |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>      116 |                          dev_id & 0xffff, (fw_ver & 0xff) + 1);
>          |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> vim +115 drivers/bluetooth/btmtk.c
>
>    105
>    106  void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
>    107                             u32 fw_flavor)
>    108  {
>    109          if (dev_id == 0x7925)
>    110                  snprintf(buf, size,
>    111                           "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
>    112                           dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
>    113          else if (dev_id == 0x7961 && fw_flavor)
>    114                  snprintf(buf, sizeof(size),
>  > 115                           "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
>    116                           dev_id & 0xffff, (fw_ver & 0xff) + 1);
>    117          else
>    118                  snprintf(buf, size,
>    119                           "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
>    120                           dev_id & 0xffff, (fw_ver & 0xff) + 1);
>    121  }
>    122  EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
>    123

Could you please fix the above?
Sean Wang May 8, 2024, 8:38 p.m. UTC | #5
Hi,

On Wed, May 8, 2024 at 7:37 AM Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
>
> Hi Sean,
>
> On Wed, May 8, 2024 at 3:13 AM kernel test robot <lkp@intel.com> wrote:
> >
> > Hi,
> >
> > kernel test robot noticed the following build warnings:
> >
> > [auto build test WARNING on bluetooth/master]
> > [also build test WARNING on bluetooth-next/master linus/master v6.9-rc7 next-20240507]
> > [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/sean-wang-kernel-org/Bluetooth-btmtk-apply-the-common-btmtk_fw_get_filename/20240508-032333
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
> > patch link:    https://lore.kernel.org/r/965cd14922aea67e2750ff2c2ecad773f8ba485a.1715109394.git.sean.wang%40kernel.org
> > patch subject: [PATCH v4 1/5] Bluetooth: btmtk: add the function to get the fw name
> > config: arm64-defconfig (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/config)
> > compiler: aarch64-linux-gcc (GCC) 13.2.0
> > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405081456.v2MvcQ0P-lkp@intel.com/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Closes: https://lore.kernel.org/oe-kbuild-all/202405081456.v2MvcQ0P-lkp@intel.com/
> >
> > All warnings (new ones prefixed by >>):
> >
> >    drivers/bluetooth/btmtk.c: In function 'btmtk_fw_get_filename':
> > >> drivers/bluetooth/btmtk.c:115:35: warning: 'mediatek/BT_RAM_CODE_MT' directive output truncated writing 23 bytes into a region of size 8 [-Wformat-truncation=]
> >      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
> >          |                           ~~~~~~~~^~~~~~~~~~~~~~~
> >    drivers/bluetooth/btmtk.c:115:26: note: directive argument in the range [1, 256]
> >      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
> >          |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    drivers/bluetooth/btmtk.c:114:17: note: 'snprintf' output between 41 and 43 bytes into a destination of size 8
> >      114 |                 snprintf(buf, sizeof(size),
> >          |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      115 |                          "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
> >          |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >      116 |                          dev_id & 0xffff, (fw_ver & 0xff) + 1);
> >          |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >
> > vim +115 drivers/bluetooth/btmtk.c
> >
> >    105
> >    106  void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
> >    107                             u32 fw_flavor)
> >    108  {
> >    109          if (dev_id == 0x7925)
> >    110                  snprintf(buf, size,
> >    111                           "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
> >    112                           dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
> >    113          else if (dev_id == 0x7961 && fw_flavor)
> >    114                  snprintf(buf, sizeof(size),
> >  > 115                           "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
> >    116                           dev_id & 0xffff, (fw_ver & 0xff) + 1);
> >    117          else
> >    118                  snprintf(buf, size,
> >    119                           "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
> >    120                           dev_id & 0xffff, (fw_ver & 0xff) + 1);
> >    121  }
> >    122  EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
> >    123
>
> Could you please fix the above?

No problem, I'll take care of it and send it over later.

                 Sean
>
> --
> Luiz Augusto von Dentz
diff mbox series

Patch

diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 812fd2a8f853..a0a858a0706d 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -103,6 +103,24 @@  static void btmtk_coredump_notify(struct hci_dev *hdev, int state)
 	}
 }
 
+void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
+			   u32 fw_flavor)
+{
+	if (dev_id == 0x7925)
+		snprintf(buf, size,
+			 "mediatek/mt%04x/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
+			 dev_id & 0xffff, dev_id & 0xffff, (fw_ver & 0xff) + 1);
+	else if (dev_id == 0x7961 && fw_flavor)
+		snprintf(buf, sizeof(size),
+			 "mediatek/BT_RAM_CODE_MT%04x_1a_%x_hdr.bin",
+			 dev_id & 0xffff, (fw_ver & 0xff) + 1);
+	else
+		snprintf(buf, size,
+			 "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
+			 dev_id & 0xffff, (fw_ver & 0xff) + 1);
+}
+EXPORT_SYMBOL_GPL(btmtk_fw_get_filename);
+
 int btmtk_setup_firmware_79xx(struct hci_dev *hdev, const char *fwname,
 			      wmt_cmd_sync_func_t wmt_cmd_sync)
 {
diff --git a/drivers/bluetooth/btmtk.h b/drivers/bluetooth/btmtk.h
index cbcdb99a22e6..e76b8a358be8 100644
--- a/drivers/bluetooth/btmtk.h
+++ b/drivers/bluetooth/btmtk.h
@@ -160,6 +160,9 @@  int btmtk_register_coredump(struct hci_dev *hdev, const char *name,
 			    u32 fw_version);
 
 int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb);
+
+void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id, u32 fw_ver,
+			   u32 fw_flavor);
 #else
 
 static inline int btmtk_set_bdaddr(struct hci_dev *hdev,
@@ -194,4 +197,9 @@  static int btmtk_process_coredump(struct hci_dev *hdev, struct sk_buff *skb)
 {
 	return -EOPNOTSUPP;
 }
+
+static void btmtk_fw_get_filename(char *buf, size_t size, u32 dev_id,
+				  u32 fw_ver, u32 fw_flavor)
+{
+}
 #endif