lkml.org 
[lkml]   [2020]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 5/9] ASoC: tegra: add Tegra210 based AHUB driver
From
Date


On 1/30/2020 10:39 PM, Dmitry Osipenko wrote:
> External email: Use caution opening links or attachments
>
>
> 30.01.2020 13:33, Sameer Pujar пишет:
> ...
>> + ret = devm_snd_soc_register_component(&pdev->dev,
>> + ahub->soc_data->cmpnt_drv,
>> + ahub->soc_data->dai_drv,
>> + ahub->soc_data->num_dais);
>> + if (ret < 0) {
>> + dev_err(&pdev->dev, "failed to register component, err: %d\n",
>> + ret);
>> + return ret;
>> + }
> In the the patch #4 ("ASoC: tegra: add Tegra210 based I2S driver") I see
> the following:
>
> ret = devm_snd_soc_register_component(dev, &tegra210_i2s_cmpnt,
> tegra210_i2s_dais,
> ARRAY_SIZE(tegra210_i2s_dais));
> if (ret != 0) {
> dev_err(dev, "can't register I2S component, err: %d\n", ret);
> return ret;
> }
>
> Please be consistent in regards to errors checking. The correct variant
> should be: if (ret != 0). Usually error codes are a negative value, but
> it is much safer to check whether value isn't 0 in all cases where
> positive value isn't expected to happen.

yes "if (ret)" is good enough in such cases.
>
> I'd also recommend to rename all "ret" variables to "err" everywhere in
> the code where returned value is used only for errors checking. This
> will make code more explicit, and hence, easier to read and follow.

OK, I will update it to 'err' for better.
>
> So, it will be nicer to write it as:
>
> err = devm_snd_soc_register_component(&pdev->dev,
> ahub->soc_data->cmpnt_drv,
> ahub->soc_data->dai_drv,
> ahub->soc_data->num_dais);
> if (err) {
> dev_err(&pdev->dev, "failed to register component: %d\n", err);
> return err;
> }

\
 
 \ /
  Last update: 2020-02-04 05:35    [W:0.118 / U:2.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site