diff options
author | Denis Kenzior <denkenz@gmail.com> | 2019-04-29 13:59:36 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2019-04-29 13:59:36 -0500 |
commit | 88f2ae3869a3baf12ef561449289c5c16e72ace3 (patch) | |
tree | 0a54bff56e20992aef66469a6ed6c8bbb1759e1a /drivers | |
parent | 413e6ecab09a27d3d8ab825bb6f3999f12c2f468 (diff) | |
download | ofono-88f2ae3869a3baf12ef561449289c5c16e72ace3.tar.gz |
atmodem: Remove unneeded if statement
if (ctx->apn) is always true since apn is an array variable
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/atmodem/gprs-context.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c index 93894efd..4e623a63 100644 --- a/drivers/atmodem/gprs-context.c +++ b/drivers/atmodem/gprs-context.c @@ -289,37 +289,35 @@ static void at_gprs_activate_primary(struct ofono_gprs_context *gc, len = snprintf(buf, sizeof(buf), "AT+CGDCONT=%u,\"IP\"", ctx->cid); - if (ctx->apn) { - switch (gcd->vendor) { - case OFONO_VENDOR_UBLOX: - /* - * U-blox modems require a magic prefix to the APN to - * specify the authentication method to use in the - * network. See UBX-13002752 - R21. - * - * As the response of the read command omits this magic - * prefix, this is the least invasive place to set it. - */ - switch (ctx->auth_method) { - case OFONO_GPRS_AUTH_METHOD_CHAP: - snprintf(buf + len, sizeof(buf) - len - 3, - ",\"CHAP:%s\"", ctx->apn); - break; - case OFONO_GPRS_AUTH_METHOD_PAP: - snprintf(buf + len, sizeof(buf) - len - 3, - ",\"PAP:%s\"", ctx->apn); - break; - case OFONO_GPRS_AUTH_METHOD_NONE: - snprintf(buf + len, sizeof(buf) - len - 3, - ",\"%s\"", ctx->apn); - break; - } + switch (gcd->vendor) { + case OFONO_VENDOR_UBLOX: + /* + * U-blox modems require a magic prefix to the APN to + * specify the authentication method to use in the + * network. See UBX-13002752 - R21. + * + * As the response of the read command omits this magic + * prefix, this is the least invasive place to set it. + */ + switch (ctx->auth_method) { + case OFONO_GPRS_AUTH_METHOD_CHAP: + snprintf(buf + len, sizeof(buf) - len - 3, + ",\"CHAP:%s\"", ctx->apn); + break; + case OFONO_GPRS_AUTH_METHOD_PAP: + snprintf(buf + len, sizeof(buf) - len - 3, + ",\"PAP:%s\"", ctx->apn); break; - default: - snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", - ctx->apn); + case OFONO_GPRS_AUTH_METHOD_NONE: + snprintf(buf + len, sizeof(buf) - len - 3, + ",\"%s\"", ctx->apn); break; } + break; + default: + snprintf(buf + len, sizeof(buf) - len - 3, ",\"%s\"", + ctx->apn); + break; } if (g_at_chat_send(gcd->chat, buf, none_prefix, |