020-07-rt2500usb-don-t-mark-register-accesses-as-inline.patch 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. From 7272416609126e8910b7f0d0e3dba008aa87830c Mon Sep 17 00:00:00 2001
  2. From: Arnd Bergmann <arnd@arndb.de>
  3. Date: Tue, 14 Feb 2017 22:28:33 +0100
  4. Subject: [PATCH 07/19] rt2500usb: don't mark register accesses as inline
  5. When CONFIG_KASAN is set, we get a rather large stack here:
  6. drivers/net/wireless/ralink/rt2x00/rt2500usb.c: In function 'rt2500usb_set_device_state':
  7. drivers/net/wireless/ralink/rt2x00/rt2500usb.c:1074:1: error: the frame size of 3032 bytes is larger than 100 bytes [-Werror=frame-larger-than=]
  8. If we don't force those functions to be inline, the compiler can figure this
  9. out better itself and not inline the functions when doing so would be harmful,
  10. reducing the stack size to a merge 256 bytes.
  11. Note that there is another problem that manifests in this driver, as a result
  12. of the typecheck() macro causing even larger stack frames.
  13. Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  14. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  15. ---
  16. drivers/net/wireless/ralink/rt2x00/rt2500usb.c | 19 +++++--------------
  17. 1 file changed, 5 insertions(+), 14 deletions(-)
  18. diff --git a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  19. index 62357465fe29..0d2670a56c4c 100644
  20. --- a/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  21. +++ b/drivers/net/wireless/ralink/rt2x00/rt2500usb.c
  22. @@ -55,7 +55,7 @@ MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
  23. * If the csr_mutex is already held then the _lock variants must
  24. * be used instead.
  25. */
  26. -static inline void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev,
  27. +static void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev,
  28. const unsigned int offset,
  29. u16 *value)
  30. {
  31. @@ -66,7 +66,7 @@ static inline void rt2500usb_register_read(struct rt2x00_dev *rt2x00dev,
  32. *value = le16_to_cpu(reg);
  33. }
  34. -static inline void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev,
  35. +static void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev,
  36. const unsigned int offset,
  37. u16 *value)
  38. {
  39. @@ -77,16 +77,7 @@ static inline void rt2500usb_register_read_lock(struct rt2x00_dev *rt2x00dev,
  40. *value = le16_to_cpu(reg);
  41. }
  42. -static inline void rt2500usb_register_multiread(struct rt2x00_dev *rt2x00dev,
  43. - const unsigned int offset,
  44. - void *value, const u16 length)
  45. -{
  46. - rt2x00usb_vendor_request_buff(rt2x00dev, USB_MULTI_READ,
  47. - USB_VENDOR_REQUEST_IN, offset,
  48. - value, length);
  49. -}
  50. -
  51. -static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
  52. +static void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
  53. const unsigned int offset,
  54. u16 value)
  55. {
  56. @@ -96,7 +87,7 @@ static inline void rt2500usb_register_write(struct rt2x00_dev *rt2x00dev,
  57. &reg, sizeof(reg));
  58. }
  59. -static inline void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev,
  60. +static void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev,
  61. const unsigned int offset,
  62. u16 value)
  63. {
  64. @@ -106,7 +97,7 @@ static inline void rt2500usb_register_write_lock(struct rt2x00_dev *rt2x00dev,
  65. &reg, sizeof(reg), REGISTER_TIMEOUT);
  66. }
  67. -static inline void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev,
  68. +static void rt2500usb_register_multiwrite(struct rt2x00_dev *rt2x00dev,
  69. const unsigned int offset,
  70. void *value, const u16 length)
  71. {
  72. --
  73. 2.12.1