lkml.org 
[lkml]   [2018]   [May]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mtd: devices: check mtd_device_register() return code
On Sat, 24 Mar 2018 16:48:20 +0530
Arushi Singhal <arushisinghal19971997@gmail.com> wrote:

Subject prefix should be "mtd: devices: st_spi_fsm: ", and it's really
about checking return code which was already propagated to the lower
layer (platform bus), but it's about making sure we disable the clk we
have previously enabled in case of failure.

BTW, I see that the clk is not disabled in ->remove(), probably
something we should fix too (in a separate patch).

> stfsm_probe() misses error handling of mtd_device_register().
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
> drivers/mtd/devices/st_spi_fsm.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
> index 7bc29d7..4a99a6a 100644
> --- a/drivers/mtd/devices/st_spi_fsm.c
> +++ b/drivers/mtd/devices/st_spi_fsm.c
> @@ -2125,7 +2125,13 @@ static int stfsm_probe(struct platform_device *pdev)
> (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20),
> fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10));
>
> - return mtd_device_register(&fsm->mtd, NULL, 0);
> + ret = mtd_device_register(&fsm->mtd, NULL, 0);
> + if (ret) {
> + pr_err("Failed to register device\n");
> + goto err_clk_unprepare;
> + }
> +
> + return 0;
>
> err_clk_unprepare:
> clk_disable_unprepare(fsm->clk);

\
 
 \ /
  Last update: 2018-05-03 12:01    [W:0.050 / U:1.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site