X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fflash%2Fnor%2Fstmsmi.c;h=f56b9b7bed3d80b955a210dbe3b13ef75f73c948;hp=662b4595353915db6e888c6d9657a04cd07be5b5;hb=HEAD;hpb=64c2e03b23d9cadc1b919d38e902a079d015ddc6 diff --git a/src/flash/nor/stmsmi.c b/src/flash/nor/stmsmi.c index 662b459535..1aa244728f 100644 --- a/src/flash/nor/stmsmi.c +++ b/src/flash/nor/stmsmi.c @@ -1,18 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + /*************************************************************************** * Copyright (C) 2010 by Antonio Borneo * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * ***************************************************************************/ /* STM Serial Memory Interface (SMI) controller is a SPI bus controller @@ -144,7 +133,7 @@ FLASH_BANK_COMMAND_HANDLER(stmsmi_flash_bank_command) return ERROR_COMMAND_SYNTAX_ERROR; stmsmi_info = malloc(sizeof(struct stmsmi_flash_bank)); - if (stmsmi_info == NULL) { + if (!stmsmi_info) { LOG_ERROR("not enough memory"); return ERROR_FAIL; } @@ -600,7 +589,7 @@ static int stmsmi_probe(struct flash_bank *bank) bank->num_sectors = stmsmi_info->dev->size_in_bytes / sectorsize; sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); - if (sectors == NULL) { + if (!sectors) { LOG_ERROR("not enough memory"); return ERROR_FAIL; }