+// SPDX-License-Identifier: GPL-2.0-or-later
+
/***************************************************************************
* Copyright (C) 2007 by Dominic Rath <Dominic.Rath@gmx.de> *
* Copyright (C) 2002 Thomas Gleixner <tglx@linutronix.de> *
* Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
* *
* Partially based on drivers/mtd/nand_ids.c from Linux. *
- * *
- * 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 <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
#include "fileio.h"
#include <target/target.h>
-/* to be removed */
-extern struct nand_device *nand_devices;
-
COMMAND_HANDLER(handle_nand_list_command)
{
struct nand_device *p;
if (retval != ERROR_OK)
return retval;
- if (NULL == p->device) {
+ if (!p->device) {
command_print(CMD, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}
return retval;
}
- if (NULL != s.page)
+ if (s.page)
fileio_write(s.fileio, s.page_size, s.page, &size_written);
- if (NULL != s.oob)
+ if (s.oob)
fileio_write(s.fileio, s.oob_size, s.oob, &size_written);
s.size -= nand->page_size;
if (retval != ERROR_OK)
return retval;
- if (NULL == p->device) {
+ if (!p->device) {
command_print(CMD, "#%s: not probed", CMD_ARGV[0]);
return ERROR_OK;
}
return ERROR_COMMAND_ARGUMENT_INVALID;
}
- if (NULL != controller->commands) {
- retval = register_commands(CMD_CTX, NULL,
- controller->commands);
+ if (controller->commands) {
+ retval = register_commands(CMD_CTX, NULL, controller->commands);
if (retval != ERROR_OK)
return retval;
}
c = malloc(sizeof(struct nand_device));
- if (c == NULL) {
+ if (!c) {
LOG_ERROR("End of memory");
return ERROR_FAIL;
}
return retval;
}
- if (controller->usage == NULL)
+ if (!controller->usage)
LOG_DEBUG("'%s' driver usage field missing", controller->name);
nand_device_add(c);
const char *driver_name = CMD_ARGV[0];
struct nand_flash_controller *controller;
controller = nand_driver_find_by_name(CMD_ARGV[0]);
- if (NULL == controller) {
+ if (!controller) {
LOG_ERROR("No valid NAND flash driver found (%s)", driver_name);
return CALL_COMMAND_HANDLER(handle_nand_list_drivers);
}