Skip to content

Commit 78a56df

Browse files
ColinIanKingmiquelraynal
authored andcommitted
mtd: phram: only call platform_driver_unregister if phram_setup fails
The check on ret and call to platform_driver_unregister is only required in the code path where MODULE is not defined. Fix this by moving this code into the relevant place after the call to phram_setup. Signed-off-by: Colin Ian King <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent 40384c8 commit 78a56df

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/mtd/devices/phram.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,14 +415,14 @@ static int __init init_phram(void)
415415
return ret;
416416

417417
#ifndef MODULE
418-
if (phram_paramline[0])
418+
if (phram_paramline[0]) {
419419
ret = phram_setup(phram_paramline);
420+
if (ret)
421+
platform_driver_unregister(&phram_driver);
422+
}
420423
phram_init_called = 1;
421424
#endif
422425

423-
if (ret)
424-
platform_driver_unregister(&phram_driver);
425-
426426
return ret;
427427
}
428428

0 commit comments

Comments
 (0)