[PATCH] ASoC: rsnd: Emit useful error messages in .remove()
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Wed Jul 6 08:26:11 CEST 2022
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/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20220706/537e4da8/attachment.sig>
More information about the Alsa-devel
mailing list