mirror of
https://github.com/xemu-project/xemu.git
synced 2025-02-09 21:53:16 +00:00
onenand: g_malloc() can't fail, bury dead error handling
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
parent
be7433efbf
commit
6b0126f940
@ -346,15 +346,9 @@ static inline int onenand_prog_spare(OneNANDState *s, int sec, int secn,
|
|||||||
static inline int onenand_erase(OneNANDState *s, int sec, int num)
|
static inline int onenand_erase(OneNANDState *s, int sec, int num)
|
||||||
{
|
{
|
||||||
uint8_t *blankbuf, *tmpbuf;
|
uint8_t *blankbuf, *tmpbuf;
|
||||||
|
|
||||||
blankbuf = g_malloc(512);
|
blankbuf = g_malloc(512);
|
||||||
if (!blankbuf) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
tmpbuf = g_malloc(512);
|
tmpbuf = g_malloc(512);
|
||||||
if (!tmpbuf) {
|
|
||||||
g_free(blankbuf);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
memset(blankbuf, 0xff, 512);
|
memset(blankbuf, 0xff, 512);
|
||||||
for (; num > 0; num--, sec++) {
|
for (; num > 0; num--, sec++) {
|
||||||
if (s->blk_cur) {
|
if (s->blk_cur) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user