WSL2-Linux-Kernel/sound/pci/asihpi
Kuninori Morimoto cb1bc12239 ALSA: asihpi: check pao in control_message()
[ Upstream commit 9026c0bf23 ]

control_message() might be called with pao = NULL.
Here indicates control_message() as sample.

(B)	static void control_message(struct hpi_adapter_obj *pao, ...)
	{                                                   ^^^
		struct hpi_hw_obj *phw = pao->priv;
		...                      ^^^
	}

(A)	void _HPI_6205(struct hpi_adapter_obj *pao, ...)
	{                                      ^^^
		...
		case HPI_OBJ_CONTROL:
(B)			control_message(pao, phm, phr);
			break;          ^^^
		...
	}

	void HPI_6205(...)
	{
		...
(A)		_HPI_6205(NULL, phm, phr);
		...       ^^^^
	}

Therefore, We will get too many warning via cppcheck, like below

	sound/pci/asihpi/hpi6205.c:238:27: warning: Possible null pointer dereference: pao [nullPointer]
		 struct hpi_hw_obj *phw = pao->priv;
		                          ^
	sound/pci/asihpi/hpi6205.c:433:13: note: Calling function '_HPI_6205', 1st argument 'NULL' value is 0
		  _HPI_6205(NULL, phm, phr);
		            ^
	sound/pci/asihpi/hpi6205.c:401:20: note: Calling function 'control_message', 1st argument 'pao' value is 0
	   control_message(pao, phm, phr);
	                   ^
Set phr->error like many functions doing, and don't call _HPI_6205()
with NULL.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ttypeaqz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-04-05 11:24:53 +02:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
asihpi.c ALSA: pci/asihpi: Remove unused function hpi_stream_group_get_map() 2020-09-09 18:42:57 +02:00
hpi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpi6000.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpi6000.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpi6205.c ALSA: asihpi: check pao in control_message() 2023-04-05 11:24:53 +02:00
hpi6205.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpi_internal.h ALSA: asihpi: delete duplicated word 2020-07-19 20:50:47 +02:00
hpi_version.h
hpicmn.c ALSA: pci/asihpi: fix kernel-doc 2020-07-07 12:03:17 +02:00
hpicmn.h ALSA: asihpi: fix comment syntax in file headers 2021-03-18 10:13:25 +01:00
hpidebug.c ALSA: asihpi: Use DIV_ROUND_UP() instead of open-coding it 2020-12-25 09:11:48 +01:00
hpidebug.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpidspcd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpidspcd.h ALSA: asihpi: fix comment syntax in file headers 2021-03-18 10:13:25 +01:00
hpifunc.c
hpimsginit.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpimsginit.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpimsgx.c ALSA: asihpi: More constifications 2020-01-05 16:14:53 +01:00
hpimsgx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpioctl.c ALSA: asihpi: fix missing pci_disable_device() 2022-12-31 13:14:13 +01:00
hpioctl.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpios.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpios.h ALSA: asihpi: fix spellint typo in comments 2020-09-21 10:31:20 +02:00
hpipcida.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00