Commit 1598dfcb101c2c3aaac68a4ac8fc9bdef2293eaa

Authored by Simon Glass
1 parent c40fdca6b7

dm: blk: Use the correct error code for blk_get_device_by_str()

Return -EINVAL instead of -1 in this function, to provide a more meaningful
error.

Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

... ... @@ -350,7 +350,7 @@
350 350 if (*ep) {
351 351 printf("** Bad device specification %s %s **\n",
352 352 ifname, dev_str);
353   - dev = -1;
  353 + dev = -EINVAL;
354 354 goto cleanup;
355 355 }
356 356  
... ... @@ -359,7 +359,7 @@
359 359 if (*ep) {
360 360 printf("** Bad HW partition specification %s %s **\n",
361 361 ifname, hwpart_str);
362   - dev = -1;
  362 + dev = -EINVAL;
363 363 goto cleanup;
364 364 }
365 365 }
... ... @@ -367,7 +367,7 @@
367 367 *dev_desc = get_dev_hwpart(ifname, dev, hwpart);
368 368 if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
369 369 printf("** Bad device %s %s **\n", ifname, dev_hwpart_str);
370   - dev = -1;
  370 + dev = -ENOENT;
371 371 goto cleanup;
372 372 }
373 373