pcd: capture error codes on pcd_probe() and pf_probe()
PATCH 1/1 pcd: capture error codes on pcd_probe() and pf_probe()
No error code were being captured when pcd_probe() and pf_probe() fail, capture them by assigning them to ret.
Clean up smatch warning:drivers/block/paride/pcd.c:939 pcd_init_unit() warn: missing error code 'ret'drivers/block/paride/pf.c:963 pf_init_unit() warn: missing error code 'ret'
--- drivers/block/paride/pcd.c | 3 ++- drivers/block/paride/pf.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/block/paride/pcd.c +2 -1
@@ -935,7 +935,8 @@ static int pcd_init_unit(struct pcd_unit *cd, bool autoprobe, int port,if (!pi_init (cd->pi, autoprobe, port, mode, unit, protocol, delay, pcd_buffer,PI_PCD , verbose, cd->name)) goto out_free_disk; -if (pcd_probe (cd, ms)) + ret =pcd_probe (cd, ms); +if (ret) goto out_pi_release; cd->present =1 ;
drivers/block/paride/pf.c +2 -1
@@ -959,7 +959,8 @@ static int __init pf_init_unit(struct pf_unit *pf, bool autoprobe, int port,if (!pi_init (pf->pi, autoprobe, port, mode, unit, protocol, delay, pf_scratch,PI_PF , verbose, pf->name)) goto out_free_disk; -if (pf_probe (pf)) + ret =pf_probe (pf); +if (ret) goto out_pi_release; ret =add_disk (disk);
Signature · 1 line
1.8.3.1
Quoted 11 lines · Yang Li
No error code were being captured when
pcd_probe()andpf_probe()fail, capture them by assigning them to ret.Clean up smatch warning:
drivers/block/paride/pcd.c:939pcd_init_unit()warn: missing error code 'ret'drivers/block/paride/pf.c:963pf_init_unit()warn: missing error code 'ret'Reported-by Abaci Robot <[email protected]>Signed-off-by Yang Li <[email protected]>
Please not. I have a major rewrite of the paride probing pending, which Jens just wanted to make conditional on potentially dropping the drivers entirely. So either we take the real series to clean this mess up or we drop the drivers, but we need to stop this sugarcoating of fundamentally bad code.