mmc: return meaningful error codes from mmc_select_hwpart
PATCH 1/1 mmc: return meaningful error codes from mmc_select_hwpart
From: Stephen Warren <[email protected]>
Rather than just returning -1 everywhere, try to return something meaningful from mmc_select_hwpart(). Note that most other MMC functions don't do this, including functions called from mmc_select_hwpart(), so I'm not sure how effective this will be. Still, it's one less place with hard-coded -1.
--- drivers/mmc/mmc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mmc/mmc.c +4 -3
@@ -10,6 +10,7 @@#include <config.h> #include <common.h> #include <command.h> +#include <errno.h> #include <mmc.h> #include <part.h> #include <malloc.h>
@@ -558,19 +559,19 @@ int mmc_select_hwpart(int dev_num, int hwpart)int ret;if (!mmc) -return -1 ; +return -ENODEV ;if (mmc->part_num == hwpart)return 0 ;if (mmc->part_config ==MMCPART_NOAVAILABLE ) {printf ("Card doesn't support part_switch\n" ); -return -1 ; +return -EMEDIUMTYPE ; } ret =mmc_switch_part (dev_num, hwpart);if (ret) -return -1 ; +return ret; mmc->part_num = hwpart;
Signature · 1 line
1.8.1.5
PATCH 1/1 mmc: return meaningful error codes from mmc_select_hwpart
Quoted 7 lines · Stephen Warren
From: Stephen Warren <[email protected]>
Rather than just returning -1 everywhere, try to return something meaningful from
mmc_select_hwpart(). Note that most other MMC functions don't do this, including functions called frommmc_select_hwpart(), so I'm not sure how effective this will be. Still, it's one less place with hard-coded -1.
Pantelis, does this look good?
PATCH 1/1 mmc: return meaningful error codes from mmc_select_hwpart
In reply to Stephen WarrenHi Stephen,
Quoted 52 lines · Stephen Warren
From: Stephen Warren <[email protected]>
Rather than just returning -1 everywhere, try to return something meaningful from
mmc_select_hwpart(). Note that most other MMC functions don't do this, including functions called frommmc_select_hwpart(), so I'm not sure how effective this will be. Still, it's one less place with hard-coded -1.Suggested-by Pantelis Antoniou <[email protected]>Signed-off-by Stephen Warren <[email protected]>---
drivers/mmc/mmc.c| 7 ++++---1 file changed, 4 insertions(+), 3 deletions(-)drivers/mmc/mmc.c +4
-3@@ -10,6 +10,7 @@#include <config.h> #include <common.h> #include <command.h> +#include <errno.h> #include <mmc.h> #include <part.h> #include <malloc.h> @@ -558,19 +559,19 @@ int mmc_select_hwpart(int dev_num, int hwpart)int ret;if (!mmc) -return -1 ; +return -ENODEV ;if (mmc->part_num == hwpart)return 0 ;if (mmc->part_config ==MMCPART_NOAVAILABLE ) {printf ("Card doesn't support part_switch\n" ); -return -1 ; +return -EMEDIUMTYPE ; } ret =mmc_switch_part (dev_num, hwpart);if (ret) -return -1 ; +return ret; mmc->part_num = hwpart;Signature · 1 line
1.8.1.5
This does indeed look good.
Thanks
-- Pantelis
PATCH 1/1 mmc: return meaningful error codes from mmc_select_hwpart
Quoted 6 lines · Pantelis Antoniou
Quoted 5 lines · Stephen Warren
Rather than just returning -1 everywhere, try to return something meaningful from
mmc_select_hwpart(). Note that most other MMC functions don't do this, including functions called frommmc_select_hwpart(), so I'm not sure how effective this will be. Still, it's one less place with hard-coded -1.
...
Quoted 1 line
This does indeed look good.
...
Quoted 1 line
Are you intending to apply this patch, or were you expecting someone else to?
PATCH 1/1 mmc: return meaningful error codes from mmc_select_hwpart
Quoted 7 lines · Stephen Warren
Quoted 6 lines · Pantelis Antoniou
Quoted 5 lines · Stephen Warren
Rather than just returning -1 everywhere, try to return something meaningful from
mmc_select_hwpart(). Note that most other MMC functions don't do this, including functions called frommmc_select_hwpart(), so I'm not sure how effective this will be. Still, it's one less place with hard-coded -1.
Quoted 7 lines
...
Quoted 1 line
This does indeed look good.
...
Quoted 1 line
Are you intending to apply this patch, or were you expecting someone else to?
I will apply the patch, but it will go out with the rest on the next mmc pull request this week.
Regards
-- Pantelis