summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Shevchenko <andy.shevchenko@gmail.com>2017-12-11 16:05:05 +0300
committerJason Gunthorpe <jgg@mellanox.com>2017-12-12 02:19:45 +0300
commite711f968c49c224527e75203cf121c7a69309030 (patch)
treece45a5a7b3f798e7a534e4693806e03fe4b86c94
parent1b19b95169cd52fe82cd442fec0b279fe25cc838 (diff)
downloadlinux-e711f968c49c224527e75203cf121c7a69309030.tar.xz
IB/srp: replace custom implementation of hex2bin()
There is no need to have a duplication of the generic library, i.e. hex2bin(). Replace the open coded variant. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 972d4b3c5223..62d88212c1b0 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3110,7 +3110,6 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
{
char *options, *sep_opt;
char *p;
- char dgid[3];
substring_t args[MAX_OPT_ARGS];
int opt_mask = 0;
int token;
@@ -3162,16 +3161,10 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
goto out;
}
- for (i = 0; i < 16; ++i) {
- strlcpy(dgid, p + i * 2, sizeof(dgid));
- if (sscanf(dgid, "%hhx",
- &target->orig_dgid.raw[i]) < 1) {
- ret = -EINVAL;
- kfree(p);
- goto out;
- }
- }
+ ret = hex2bin(target->orig_dgid.raw, p, 16);
kfree(p);
+ if (ret < 0)
+ goto out;
break;
case SRP_OPT_PKEY: