Skip to content
Snippets Groups Projects
Commit 317d81db authored by Ronny Nilsson's avatar Ronny Nilsson
Browse files

Remove an argument we already know by a global variable.

parent 39541e16
Branches
No related tags found
No related merge requests found
......@@ -117,25 +117,23 @@ static unsigned int ubi_read_blk(unsigned char *start, unsigned int blk, unsigne
//-------------------------------------------------------------
// Erase an UBI volume (if exists).
int ubi_erase_volume(int devId, int volId)
int ubi_erase_volume(int volId)
{
char nodePath[UBI_MAX_VOLUME_NAME];
struct ubi_vol_info volInfo;
memset(&volInfo, 0, sizeof(volInfo));
if(!ubi_dev_present(libubi, devId)) return -1;
if(ubi_get_vol_info1(libubi, devId, volId, &volInfo) && errno == ENODEV) {
if(ubi_get_vol_info1(libubi, devInfo.dev_num, volId, &volInfo) && errno == ENODEV) {
fprintf(stderr, "Error deleting volume %d: %s\n", volId, strerror(errno));
return -1;
}
else if(volInfo.dev_num != devId || volInfo.vol_id != volId) {
else if(volInfo.dev_num != devInfo.dev_num || volInfo.vol_id != volId) {
fprintf(stderr, "Error deleting volume %d\n", volId);
return -1;
}
snprintf(nodePath, UBI_MAX_VOLUME_NAME, "/dev/ubi%d", devId);
snprintf(nodePath, UBI_MAX_VOLUME_NAME, "/dev/ubi%d", devInfo.dev_num);
if(ubi_rmvol(libubi, nodePath, volId)) {
fprintf(stderr, "Error deleting volume %d: %s\n", volId, strerror(errno));
return -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment