Re: [PATCH next] mmc: sunplus: Fix error handling in spmmc_drv_probe()

From: Harshit Mogalapalli
Date: Tue Aug 08 2023 - 15:05:46 EST


Hi,

On 08/08/23 2:30 pm, Ulf Hansson wrote:
On Tue, 1 Aug 2023 at 07:23, Harshit Mogalapalli
<harshit.m.mogalapalli@xxxxxxxxxx> wrote:

There are few issues in spmmc_drv_probe():

1. When mmc allocation fails, goto is a no-op.
2. When mmc allocation succeeds, the error paths should use goto instead
of direct return.

Rather than adding a bunch of new "gotos", how about converting into
using devm_mmc_alloc_host()?

Thanks for the suggestion. Yes it would reduce many "gotos".

Will send a V2 with the changes.

3. platform_get_irq() doesn't return zero, so '<' is sufficient.

(Also will split this into different patch as it's fixing a different thing than above.)

Thanks,
Harshit
Fix the above issues by adding goto instead of direct return, also
remove NULL check in 'probe_free_host' as we changed the goto to return
when mmc_alloc_host() fails.

Fixes: 4e268fed8b18 ("mmc: Add mmc driver for Sunplus SP7021")
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Closes: https://lore.kernel.org/all/a3829ed3-d827-4b9d-827e-9cc24a3ec3bc@moroto.mountain/
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@xxxxxxxxxx>

Other than the above, this looks good to me!

Kind regards
Uffe