regmap: kunit: Fix an NULL vs IS_ERR() check
authorDan Carpenter <dan.carpenter@linaro.org>
Mon, 15 Apr 2024 10:34:54 +0000 (13:34 +0300)
committerMark Brown <broonie@kernel.org>
Mon, 15 Apr 2024 10:54:57 +0000 (19:54 +0900)
commit991b5e2aad870828669ca105f424ef1b2534f820
treec12bffc2c9255601799a7dab973a89a269fb9617
parent135cec6ba82ebffc0275c5228b4c4bf279fbf6f5
regmap: kunit: Fix an NULL vs IS_ERR() check

The kunit_device_register() function returns error pointers, not NULL.
Passing an error pointer to get_device() will lead to an Oops.  Also
get_device() returns the same device you passed to it.  Fix it!  ;)

Fixes: 7b7982f14315 ("regmap: kunit: Create a struct device for the regmap")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/b32e80cf-b385-40cd-b8ec-77ec73e07530@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/base/regmap/regmap-kunit.c