[PATCH] ASoC: cs48l32: Use PTR_ERR_OR_ZERO() to simplify code

Xichao Zhao posted 1 patch 2 months ago
sound/soc/codecs/cs48l32-tables.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH] ASoC: cs48l32: Use PTR_ERR_OR_ZERO() to simplify code
Posted by Xichao Zhao 2 months ago
Use the standard error pointer macro to shorten the code and simplify.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 sound/soc/codecs/cs48l32-tables.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sound/soc/codecs/cs48l32-tables.c b/sound/soc/codecs/cs48l32-tables.c
index 59eaa9a5029f..8ff3652a010e 100644
--- a/sound/soc/codecs/cs48l32-tables.c
+++ b/sound/soc/codecs/cs48l32-tables.c
@@ -533,8 +533,6 @@ static const struct regmap_config cs48l32_regmap = {
 int cs48l32_create_regmap(struct spi_device *spi, struct cs48l32 *cs48l32)
 {
 	cs48l32->regmap = devm_regmap_init_spi(spi, &cs48l32_regmap);
-	if (IS_ERR(cs48l32->regmap))
-		return PTR_ERR(cs48l32->regmap);
 
-	return 0;
+	return PTR_ERR_OR_ZERO(cs48l32->regmap);
 }
-- 
2.34.1
Re: [PATCH] ASoC: cs48l32: Use PTR_ERR_OR_ZERO() to simplify code
Posted by Mark Brown 1 month, 3 weeks ago
On Tue, 05 Aug 2025 17:04:31 +0800, Xichao Zhao wrote:
> Use the standard error pointer macro to shorten the code and simplify.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: cs48l32: Use PTR_ERR_OR_ZERO() to simplify code
      commit: 3059067fd3378a5454e7928c08d20bf3ef186760

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH] ASoC: cs48l32: Use PTR_ERR_OR_ZERO() to simplify code
Posted by Richard Fitzgerald 1 month, 3 weeks ago
On 05/08/2025 10:04 am, Xichao Zhao wrote:
> Use the standard error pointer macro to shorten the code and simplify.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>   sound/soc/codecs/cs48l32-tables.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/cs48l32-tables.c b/sound/soc/codecs/cs48l32-tables.c
> index 59eaa9a5029f..8ff3652a010e 100644
> --- a/sound/soc/codecs/cs48l32-tables.c
> +++ b/sound/soc/codecs/cs48l32-tables.c
> @@ -533,8 +533,6 @@ static const struct regmap_config cs48l32_regmap = {
>   int cs48l32_create_regmap(struct spi_device *spi, struct cs48l32 *cs48l32)
>   {
>   	cs48l32->regmap = devm_regmap_init_spi(spi, &cs48l32_regmap);
> -	if (IS_ERR(cs48l32->regmap))
> -		return PTR_ERR(cs48l32->regmap);
>   
> -	return 0;
> +	return PTR_ERR_OR_ZERO(cs48l32->regmap);
>   }
Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>