Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: soc-dai: return proper error for get_sdw_stream()

snd_soc_dai_get_sdw_stream() returns null if dai does not support
this callback, this is no very useful for the caller to
differentiate if this is an error or unsupported call for the dai.

return -ENOTSUPP in cases where this callback is not supported.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20200316151110.2580-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Srinivas Kandagatla and committed by
Mark Brown
308811a3 673f45f7

+2 -2
+2 -2
include/sound/soc-dai.h
··· 433 433 * This routine only retrieves that was previously configured 434 434 * with snd_soc_dai_get_sdw_stream() 435 435 * 436 - * Returns pointer to stream or NULL; 436 + * Returns pointer to stream or -ENOTSUPP if callback is not supported; 437 437 */ 438 438 static inline void *snd_soc_dai_get_sdw_stream(struct snd_soc_dai *dai, 439 439 int direction) ··· 441 441 if (dai->driver->ops->get_sdw_stream) 442 442 return dai->driver->ops->get_sdw_stream(dai, direction); 443 443 else 444 - return NULL; 444 + return ERR_PTR(-ENOTSUPP); 445 445 } 446 446 447 447 #endif