public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* re: ACPICA: ACPI 2.0, Interpreter: Fix MLC issues by switching to new TermList grammar for table loading
@ 2016-06-04 14:04 Dan Carpenter
  2016-06-06 10:05 ` Zheng, Lv
  2016-06-06 10:26 ` [PATCH] ACPICA: Namespace: Fix wrong cleanup code in acpi_ns_execute_table() Lv Zheng
  0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-06-04 14:04 UTC (permalink / raw)
  To: lv.zheng; +Cc: linux-acpi

Hello Lv Zheng,

The patch 0bfd2f1ec274: "ACPICA: ACPI 2.0, Interpreter: Fix MLC
issues by switching to new TermList grammar for table loading" from
May 13, 2016, leads to the following static checker warning:

	drivers/acpi/acpica/nsparse.c:139 acpi_ns_execute_table()
	error: we previously assumed 'info' could be null (see line 110)

drivers/acpi/acpica/nsparse.c
   135          (void)acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);
   136  
   137  cleanup:
   138          acpi_ut_remove_reference(method_obj);
   139          ACPI_FREE(info->full_pathname);
                          ^^^^^^^^^^^^^^^^^^^
Archetypal one err bug.  It's better to unwind in reverse order from how
you allacted things and only free things you have allocated.  Use more
than one label.  Also you can use more descriptive label names.

	(void)acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE);

free_pathname:
	ACPI_FREE(info->full_pathname);
free_info:
	ACPI_FREE(info);
remove_method:
	acpi_ut_remove_reference(method_obj);

	return_ACPI_STATUS(status);


   140          info->full_pathname = NULL;
   141          ACPI_FREE(info);
   142          return_ACPI_STATUS(status);
   143  }

regards,
dan carpenter

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

end of thread, other threads:[~2016-06-06 10:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-04 14:04 ACPICA: ACPI 2.0, Interpreter: Fix MLC issues by switching to new TermList grammar for table loading Dan Carpenter
2016-06-06 10:05 ` Zheng, Lv
2016-06-06 10:24   ` Dan Carpenter
2016-06-06 10:26 ` [PATCH] ACPICA: Namespace: Fix wrong cleanup code in acpi_ns_execute_table() Lv Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox