On 8 August 2017 at 13:04, Stefan Hajnoczi <stefa...@gmail.com> wrote:
> On Fri, Aug 04, 2017 at 04:01:18PM +0200, Markus Armbruster wrote:
>> blk_getlength() can fail.  I figure the following need fixing:
>>
>> hw/arm/musicpal.c: musicpal_init()
>
> Seems okay:
>
> flash_size = blk_getlength(blk);
> if (flash_size != 8*1024*1024 && flash_size != 16*1024*1024 &&
>     flash_size != 32*1024*1024) {
>     fprintf(stderr, "Invalid flash image size\n");
>     exit(1);
> }

A lot of the time for flash devices it's not possible to
get an error code out of blk_getlength() anyway, because
AFAIK it only happens for cases like "cdrom with CD
ejected" and "sd card emulating the card-ejected state".
Still better to handle the error value than not, though.

thanks
-- PMM

Reply via email to