ASoC: starfive: Fix an error check in jh7110_tdm_clk_reset_get()

Fix the check for devm_reset_control_array_get_exclusive() return value.
The devm_reset_control_array_get_exclusive() function may return NULL if
it's an optional request. If optional is intended then NULL should not
be treated as an error case, but as a special kind of success case. So
here the IS_ERR() is used to check better.

Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230608135750.11041-2-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Walker Chen 2023-06-08 21:57:49 +08:00 committed by Mark Brown
parent 08e6c4bb17
commit 3582cf94ff
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -580,10 +580,9 @@ static int jh7110_tdm_clk_reset_get(struct platform_device *pdev,
}
tdm->resets = devm_reset_control_array_get_exclusive(&pdev->dev);
if (IS_ERR_OR_NULL(tdm->resets)) {
ret = PTR_ERR(tdm->resets);
dev_err(&pdev->dev, "Failed to get tdm resets");
return ret;
if (IS_ERR(tdm->resets)) {
dev_err(&pdev->dev, "Failed to get tdm resets\n");
return PTR_ERR(tdm->resets);
}
return 0;