Loading drivers/gpu/drm/msm/dsi-staging/dsi_parser.c +47 −26 Original line number Original line Diff line number Diff line Loading @@ -198,23 +198,29 @@ static void dsi_parser_get_int_value(struct dsi_parser_prop *prop, for (i = 0; i < prop->len; i++) { for (i = 0; i < prop->len; i++) { int base, val; int base, val; char *to_int, *tmp; char item[SZ_128]; strlcpy(item, prop->items[i], SZ_128); tmp = item; if (forced_base) { if (forced_base) { base = forced_base; base = forced_base; } else { } else { char *to_int = strsep(&prop->items[i], "x"); to_int = strsep(&tmp, "x"); if (!prop->items[i]) { if (!tmp) { prop->items[i] = to_int; tmp = to_int; base = 10; base = 10; } else { } else { base = 16; base = 16; } } } } if (kstrtoint(prop->items[i], base, &val)) { if (kstrtoint(tmp, base, &val)) { pr_err("error converting %s at %d\n", pr_err("error converting %s at %d\n", prop->items[i], i); tmp, i); continue; continue; } } Loading Loading @@ -478,11 +484,19 @@ struct property *dsi_parser_find_property(const struct device_node *np, if (!prop) { if (!prop) { pr_debug("%s not found\n", name); pr_debug("%s not found\n", name); goto end; goto end; } else { *lenp = strlen(prop->raw); } } pr_debug("%s: len=%d\n", name, *lenp); if (lenp) { if (prop->type == DSI_PROP_TYPE_INT_ARRAY) *lenp = prop->len; else if (prop->type == DSI_PROP_TYPE_INT_SET_ARRAY || prop->type == DSI_PROP_TYPE_INT_SET) *lenp = prop->len * sizeof(u32); else *lenp = strlen(prop->raw) + 1; pr_debug("%s len=%d\n", name, *lenp); } end: end: return (struct property *)prop; return (struct property *)prop; } } Loading Loading @@ -533,8 +547,7 @@ int dsi_parser_read_u32(const struct device_node *np, { { struct dsi_parser_node *node = (struct dsi_parser_node *)np; struct dsi_parser_node *node = (struct dsi_parser_node *)np; struct dsi_parser_prop *prop; struct dsi_parser_prop *prop; char *property = NULL; char *property, *to_int, item[SZ_128]; char *to_int; int rc = 0, base; int rc = 0, base; prop = dsi_parser_search_property(node, propname); prop = dsi_parser_search_property(node, propname); Loading @@ -542,10 +555,13 @@ int dsi_parser_read_u32(const struct device_node *np, pr_debug("%s not found\n", propname); pr_debug("%s not found\n", propname); rc = -EINVAL; rc = -EINVAL; goto end; goto end; } else { property = prop->value; } } if (!prop->value) goto end; strlcpy(item, prop->value, SZ_128); property = item; to_int = strsep(&property, "x"); to_int = strsep(&property, "x"); if (!property) { if (!property) { Loading @@ -555,12 +571,10 @@ int dsi_parser_read_u32(const struct device_node *np, base = 16; base = 16; } } if (!property) goto end; rc = kstrtoint(property, base, out_value); rc = kstrtoint(property, base, out_value); if (rc) { if (rc) { pr_err("error(%d) converting %s\n", rc, property); pr_err("prop=%s error(%d) converting %s, base=%d\n", propname, rc, property, base); goto end; goto end; } } Loading @@ -586,22 +600,26 @@ int dsi_parser_read_u32_array(const struct device_node *np, for (i = 0; i < prop->len; i++) { for (i = 0; i < prop->len; i++) { int base, val; int base, val; char *to_int = strsep(&prop->items[i], "x"); char item[SZ_128]; char *to_int, *tmp; strlcpy(item, prop->items[i], SZ_128); tmp = item; if (!prop->items[i]) { to_int = strsep(&tmp, "x"); prop->items[i] = to_int; if (!tmp) { tmp = to_int; base = 10; base = 10; } else { } else { base = 16; base = 16; } } if (!prop->items[i]) rc = kstrtoint(tmp, base, &val); continue; if (rc) { pr_err("prop=%s error(%d) converting %s(%d), base=%d\n", if (kstrtoint(prop->items[i], base, &val)) { propname, rc, tmp, i, base); pr_err("error converting %s at %d\n", prop->items[i], i); continue; continue; } } Loading Loading @@ -634,6 +652,9 @@ const void *dsi_parser_get_property(const struct device_node *np, if (lenp) { if (lenp) { if (prop->type == DSI_PROP_TYPE_INT_ARRAY) if (prop->type == DSI_PROP_TYPE_INT_ARRAY) *lenp = prop->len; *lenp = prop->len; else if (prop->type == DSI_PROP_TYPE_INT_SET_ARRAY || prop->type == DSI_PROP_TYPE_INT_SET) *lenp = prop->len * sizeof(u32); else else *lenp = strlen(prop->raw) + 1; *lenp = strlen(prop->raw) + 1; Loading Loading
drivers/gpu/drm/msm/dsi-staging/dsi_parser.c +47 −26 Original line number Original line Diff line number Diff line Loading @@ -198,23 +198,29 @@ static void dsi_parser_get_int_value(struct dsi_parser_prop *prop, for (i = 0; i < prop->len; i++) { for (i = 0; i < prop->len; i++) { int base, val; int base, val; char *to_int, *tmp; char item[SZ_128]; strlcpy(item, prop->items[i], SZ_128); tmp = item; if (forced_base) { if (forced_base) { base = forced_base; base = forced_base; } else { } else { char *to_int = strsep(&prop->items[i], "x"); to_int = strsep(&tmp, "x"); if (!prop->items[i]) { if (!tmp) { prop->items[i] = to_int; tmp = to_int; base = 10; base = 10; } else { } else { base = 16; base = 16; } } } } if (kstrtoint(prop->items[i], base, &val)) { if (kstrtoint(tmp, base, &val)) { pr_err("error converting %s at %d\n", pr_err("error converting %s at %d\n", prop->items[i], i); tmp, i); continue; continue; } } Loading Loading @@ -478,11 +484,19 @@ struct property *dsi_parser_find_property(const struct device_node *np, if (!prop) { if (!prop) { pr_debug("%s not found\n", name); pr_debug("%s not found\n", name); goto end; goto end; } else { *lenp = strlen(prop->raw); } } pr_debug("%s: len=%d\n", name, *lenp); if (lenp) { if (prop->type == DSI_PROP_TYPE_INT_ARRAY) *lenp = prop->len; else if (prop->type == DSI_PROP_TYPE_INT_SET_ARRAY || prop->type == DSI_PROP_TYPE_INT_SET) *lenp = prop->len * sizeof(u32); else *lenp = strlen(prop->raw) + 1; pr_debug("%s len=%d\n", name, *lenp); } end: end: return (struct property *)prop; return (struct property *)prop; } } Loading Loading @@ -533,8 +547,7 @@ int dsi_parser_read_u32(const struct device_node *np, { { struct dsi_parser_node *node = (struct dsi_parser_node *)np; struct dsi_parser_node *node = (struct dsi_parser_node *)np; struct dsi_parser_prop *prop; struct dsi_parser_prop *prop; char *property = NULL; char *property, *to_int, item[SZ_128]; char *to_int; int rc = 0, base; int rc = 0, base; prop = dsi_parser_search_property(node, propname); prop = dsi_parser_search_property(node, propname); Loading @@ -542,10 +555,13 @@ int dsi_parser_read_u32(const struct device_node *np, pr_debug("%s not found\n", propname); pr_debug("%s not found\n", propname); rc = -EINVAL; rc = -EINVAL; goto end; goto end; } else { property = prop->value; } } if (!prop->value) goto end; strlcpy(item, prop->value, SZ_128); property = item; to_int = strsep(&property, "x"); to_int = strsep(&property, "x"); if (!property) { if (!property) { Loading @@ -555,12 +571,10 @@ int dsi_parser_read_u32(const struct device_node *np, base = 16; base = 16; } } if (!property) goto end; rc = kstrtoint(property, base, out_value); rc = kstrtoint(property, base, out_value); if (rc) { if (rc) { pr_err("error(%d) converting %s\n", rc, property); pr_err("prop=%s error(%d) converting %s, base=%d\n", propname, rc, property, base); goto end; goto end; } } Loading @@ -586,22 +600,26 @@ int dsi_parser_read_u32_array(const struct device_node *np, for (i = 0; i < prop->len; i++) { for (i = 0; i < prop->len; i++) { int base, val; int base, val; char *to_int = strsep(&prop->items[i], "x"); char item[SZ_128]; char *to_int, *tmp; strlcpy(item, prop->items[i], SZ_128); tmp = item; if (!prop->items[i]) { to_int = strsep(&tmp, "x"); prop->items[i] = to_int; if (!tmp) { tmp = to_int; base = 10; base = 10; } else { } else { base = 16; base = 16; } } if (!prop->items[i]) rc = kstrtoint(tmp, base, &val); continue; if (rc) { pr_err("prop=%s error(%d) converting %s(%d), base=%d\n", if (kstrtoint(prop->items[i], base, &val)) { propname, rc, tmp, i, base); pr_err("error converting %s at %d\n", prop->items[i], i); continue; continue; } } Loading Loading @@ -634,6 +652,9 @@ const void *dsi_parser_get_property(const struct device_node *np, if (lenp) { if (lenp) { if (prop->type == DSI_PROP_TYPE_INT_ARRAY) if (prop->type == DSI_PROP_TYPE_INT_ARRAY) *lenp = prop->len; *lenp = prop->len; else if (prop->type == DSI_PROP_TYPE_INT_SET_ARRAY || prop->type == DSI_PROP_TYPE_INT_SET) *lenp = prop->len * sizeof(u32); else else *lenp = strlen(prop->raw) + 1; *lenp = strlen(prop->raw) + 1; Loading