Powered by Linux
Re: [PATCH] check_unwind: Add request/release_firmware to the function table — Semantic Matching Tool

Re: [PATCH] check_unwind: Add request/release_firmware to the function table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dan,

On 31/10/23 8:21 pm, Dan Carpenter wrote:
On Tue, Oct 31, 2023 at 05:06:47AM -0700, Harshit Mogalapalli wrote:
Add request and release firmware to catch bugs where there is an
imbalance between release and request firmware.

request_firmware(const struct firmware **firmware_p, const char *name,
		 struct device *device)

release frees(firmware) so we should pass '0' to the table entry in the
ALLOC.

Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>
---
  check_unwind.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/check_unwind.c b/check_unwind.c
index 59678a94..0dc8f752 100644
--- a/check_unwind.c
+++ b/check_unwind.c
@@ -95,6 +95,9 @@ static struct ref_func_info func_table[] = {
{ "ieee80211_alloc_hw", ALLOC, -1, "$", &valid_ptr_min_sval, &valid_ptr_max_sval },
  	{ "ieee80211_free_hw",  RELEASE, 0, "$" },
+
+	{ "request_firmware", ALLOC,	0, "$", &valid_ptr_min_sval, &valid_ptr_max_sval },

Doesn't request_firmware() return zero on success?  &int_zero?


Right, I missed that sorry.

I will fix it in V2.

This also answers why my test complained like this incorrectly, but I thought that was due to db:

drivers/usb/typec/tipd/core.c:1009 tps25750_start_patch_burst_mode() warn: '&fw' from request_firmware() not released on lines: 960. drivers/usb/typec/tipd/core.c:1009 tps25750_start_patch_burst_mode() warn: '&fw' from request_firmware() not released on lines: 971,976,980,1009.

But when I changed it to &int_zero, it works well and shows this warning alone:

drivers/usb/typec/tipd/core.c:1009 tps25750_start_patch_burst_mode() warn: '&fw' from request_firmware() not released on lines: 971,976,980,1009.

Thanks i will send a V2.

Regards,
Harshit
regards,
dan carpenter





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux