linux/sound/pci/asihpi
Kuninori Morimoto 9026c0bf23 ALSA: asihpi: check pao in control_message()
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>
2023-03-14 17:02:15 +01:00
..
asihpi.c ALSA: asihpi: remove variable loops 2022-10-24 16:01:33 +02:00
hpi_internal.h ALSA: asihpi: delete duplicated word 2020-07-19 20:50:47 +02:00
hpi_version.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
hpi.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
hpi6000.c ALSA: asihpi: fix repeated words in comments 2022-07-25 08:28:00 +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-03-14 17:02:15 +01:00
hpi6205.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 273 2019-06-05 17:30:30 +02:00
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 ALSA: asihpi - Remove useless code in hpi_meter_get_peak() 2022-09-01 14:37:22 +02:00
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 - Remove unused struct hpi_subsys_response 2022-09-29 08:12:28 +02: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-11-28 14:52:06 +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
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00