On Mon, Jan 10, 2022 at 03:50:45PM +0100, Tobias Heider wrote:
> Makes sense. I also fixed the one in sdmmc_mem_send_cxd_data().

Doesn't build here, there a few errors like this:

/usr/src/sys/dev/sdmmc/sdmmc_mem.c:483:1: error: unused label 'out' [-Werror,-Wu
nused-label] 

I like Visa's idea of using early 'return ENOMEM' instead of goto.

> diff --git a/sys/dev/sdmmc/sdmmc_mem.c b/sys/dev/sdmmc/sdmmc_mem.c
> index fae8d63912d..d46b1d612be 100644
> --- a/sys/dev/sdmmc/sdmmc_mem.c
> +++ b/sys/dev/sdmmc/sdmmc_mem.c
> @@ -466,7 +466,7 @@ sdmmc_mem_send_scr(struct sdmmc_softc *sc, uint32_t *scr)
>  
>       ptr = malloc(datalen, M_DEVBUF, M_NOWAIT | M_ZERO);
>       if (ptr == NULL)
> -             goto out;
> +             return ENOMEM;
>  
>       memset(&cmd, 0, sizeof(cmd));
>       cmd.c_data = ptr;
> @@ -528,10 +528,8 @@ sdmmc_mem_send_cxd_data(struct sdmmc_softc *sc, int 
> opcode, void *data,
>       int error = 0;
>  
>       ptr = malloc(datalen, M_DEVBUF, M_NOWAIT | M_ZERO);
> -     if (ptr == NULL) {
> -             error = ENOMEM;
> -             goto out;
> -     }
> +     if (ptr == NULL)
> +             return ENOMEM;
>  
>       memset(&cmd, 0, sizeof(cmd));
>       cmd.c_data = ptr;
> @@ -608,7 +606,7 @@ sdmmc_mem_sd_switch(struct sdmmc_function *sf, int mode, 
> int group,
>  
>       ptr = malloc(statlen, M_DEVBUF, M_NOWAIT | M_ZERO);
>       if (ptr == NULL)
> -             goto out;
> +             return ENOMEM;
>  
>       memset(&cmd, 0, sizeof(cmd));
>       cmd.c_data = ptr;
> 

Reply via email to