Re: [PATCH] ASoC: rsnd: Emit useful error messages in .remove()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 05, 2022 at 11:21:20PM +0000, Kuninori Morimoto wrote:
> 
> Hi Uwe
> 
> Thank you for your patch
> 
> >  	for_each_rsnd_dai(rdai, priv, i) {
> > -		ret |= rsnd_dai_call(remove, &rdai->playback, priv);
> > -		ret |= rsnd_dai_call(remove, &rdai->capture, priv);
> > +		int ret;
> > +
> > +		ret = rsnd_dai_call(remove, &rdai->playback, priv);
> > +		if (ret)
> > +			dev_warn(&pdev->dev, "Failed to remove playback dai #%d\n", i);
> > +
> > +		ret = rsnd_dai_call(remove, &rdai->capture, priv);
> > +		if (ret)
> > +			dev_warn(&pdev->dev, "Failed to remove capture dai #%d\n", i);
> >  	}
> >  
> >  	for (i = 0; i < ARRAY_SIZE(remove_func); i++)
> >  		remove_func[i](priv);
> >  
> > -	return ret;
> > +	return 0;
> >  }
> 
> I think we want to get return error ?

The motivation of my patch is to make the remove function return 0 and
the eventual goal is to make the remove callback return void.
The difference today between returning 0 and returning an error is only
that the core emits an error message in the error case. In both cases
the device is removed. See drivers/base/platform.c:platform_remove().
 
> The reason why it was using |= is that it should call all function
> without break even though it was error

It's right to call all cleanup functions also if some of them fail. But
returning an error is useless.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux