lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3527f3b8-225d-6e5a-dd8a-0421d475f70b@denx.de>
Date:   Mon, 27 Apr 2020 21:46:44 +0200
From:   Marek Vasut <marex@...x.de>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Christophe Kerello <christophe.kerello@...com>, richard@....at,
        vigneshr@...com, lee.jones@...aro.org, robh+dt@...nel.org,
        mark.rutland@....com, tony@...mide.com,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        devicetree@...r.kernel.org
Subject: Re: [PATCH v2 04/12] mtd: rawnand: stm32_fmc2: manage all errors
 cases at probe time

On 4/27/20 8:08 PM, Miquel Raynal wrote:
[...]
>>>>  	/* FMC2 init routine */
>>>>  	stm32_fmc2_init(fmc2);
>>>> @@ -1997,7 +2001,7 @@ static int stm32_fmc2_probe(struct platform_device *pdev)
>>>>  	/* Scan to find existence of the device */
>>>>  	ret = nand_scan(chip, nand->ncs);
>>>>  	if (ret)
>>>> -		goto err_scan;
>>>> +		goto err_dma_setup;
>>>>  
>>>>  	ret = mtd_device_register(mtd, NULL, 0);
>>>>  	if (ret)
>>>> @@ -2010,7 +2014,7 @@ static int stm32_fmc2_probe(struct platform_device *pdev)
>>>>  err_device_register:
>>>>  	nand_cleanup(chip);
>>>>  
>>>> -err_scan:
>>>> +err_dma_setup:
>>>>  	if (fmc2->dma_ecc_ch)
>>>>  		dma_release_channel(fmc2->dma_ecc_ch);
>>>>  	if (fmc2->dma_tx_ch)
>>>> @@ -2021,6 +2025,7 @@ static int stm32_fmc2_probe(struct platform_device *pdev)
>>>>  	sg_free_table(&fmc2->dma_data_sg);
>>>>  	sg_free_table(&fmc2->dma_ecc_sg);
>>>>  
>>>> +err_clk_disable:
>>>>  	clk_disable_unprepare(fmc2->clk);
>>>>  
>>>>  	return ret;  
>>>
>>> I didn't spot it during my earlier reviews but I really prefer using
>>> labels explaining what you do than having the same name of the function
>>> which failed. This way you don't have to rework the error path when
>>> you handle an additional error.
>>>
>>> So, would you mind doing this in two steps:
>>>
>>> 1/
>>> Replace
>>>
>>>     err_scan:
>>>
>>> with, eg.
>>>
>>>     release_dma_objs:  
>>
>> The ^err_ prefix in failpath labels is useful, since it's easily
>> possible to match on it with regexes ; not so much on arbitrary label name.
> 
> I guess so, but is it actually useful to catch labels in a regex? (real
> question)

I find it useful to have a unified way to find those labels, e.g.
err_because_foo:
err_because_bar:
err_last_one:
is much nicer than:
foo_failed:
bar_also_failed:
its_total_randomness:

> Any way I suppose catching ":\n" is already a good approximation to
> find labels?

Not very practical with git grep (^err.*: works nicely though)

>> btw would it make sense to split the first three patches of this series
>> into a separate series ? This rawnand part seems more like an unrelated
>> cleanup.
> 
> As it seems that the MFD discussion can take longer, then I would say
> yes, at least for the cleanup/misc changes part.
Right

-- 
Best regards,
Marek Vasut

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ