soundwire: intel: prevent possible dereference in hw_params
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 6 Aug 2019 00:55:06 +0000 (19:55 -0500)
committerVinod Koul <vkoul@kernel.org>
Wed, 21 Aug 2019 09:06:01 +0000 (14:36 +0530)
commit05c8afe42559c98f89022431e457bfbdaf01c806
treeba6c5482009bbb8af24fa372f6dd91cd0ab2baa6
parent15ed3ea2280e3afaea82afa664a6d1adc65b0009
soundwire: intel: prevent possible dereference in hw_params

This should not happen in production systems but we should test for
all callback arguments before invoking the config_stream callback.

Update the prototype to clarify that the first argument is mandatory.

Also use local variable instead of multiple dereferences to improve
readability.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190806005522.22642-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/intel.c
include/linux/soundwire/sdw_intel.h