[Mesa-dev] [PATCH] radeonsi: Add missing error-checking to si_create_compute_state

Edward O'Callaghan funfunctor at folklore1984.net
Mon Nov 21 11:56:28 UTC 2016



On 11/21/2016 07:26 PM, Mun Gwan-gyeong wrote:
> When the uploading of shader fails on si_shader_binary_upload(),
> it returns -ENOMEM. We handles si_shader_binary_upload() failure path
s/We handles/We should handle/

> on si_create_compute_state().
> 
> CID 1394027
> 
> Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
> ---
>  src/gallium/drivers/radeonsi/si_compute.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_compute.c b/src/gallium/drivers/radeonsi/si_compute.c
> index f1887bb..c813621 100644
> --- a/src/gallium/drivers/radeonsi/si_compute.c
> +++ b/src/gallium/drivers/radeonsi/si_compute.c
> @@ -165,7 +165,11 @@ static void *si_create_compute_state(
>  		}
>  		si_shader_dump(sctx->screen, &program->shader, &sctx->b.debug,
>  			       PIPE_SHADER_COMPUTE, stderr);
> -		si_shader_binary_upload(sctx->screen, &program->shader);
> +		if (si_shader_binary_upload(sctx->screen, &program->shader)) {
maybe this should check < 0 explicitly, so

if (si_shader_binary_upload(sctx->screen, &program->shader) < 0) {

> +			fprintf(stderr, "LLVM failed to upload shader\n");
> +			FREE(program);
> +			return NULL;
> +		}
>  	}
>  
>  	return program;
> 

With those fixes,
Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161121/ba512b13/attachment.sig>


More information about the mesa-dev mailing list