[PATCH] ASoC: rsnd: adg: clearly handle clock error / NULL case

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Jun 14 00:57:32 CEST 2021


Hi Dan

Thank you for your feedback

> > @@ -430,9 +430,9 @@ static int rsnd_adg_get_clkin(struct rsnd_priv *priv)
> >  	for (i = 0; i < CLKMAX; i++) {
> >  		clk = devm_clk_get(dev, clk_name[i]);
> >  
> > -		if (IS_ERR(clk))
> > +		if (IS_ERR_OR_NULL(clk))
> >  			clk = rsnd_adg_null_clk_get(priv);
> > -		if (IS_ERR(clk))
> > +		if (IS_ERR_OR_NULL(clk))
> 
> "clk" can't be NULL here, right?  So this should just be:
> 
> 	if (IS_ERR(clk))

clk_register_fixed_rate() might return NULL ?
I'm not sure detail.
It is indicating that "error / NULL are both error on this driver".

> (because when a function returns NULL it shouldn't print an error)

It is "from clk framework point of view" right ?
This driver doesn't assume "NULL clk" for any case.

Thank you for your help !!

Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list