summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2015-10-20 09:52:00 (GMT)
committerMarek Vasut <marex@denx.de>2015-11-03 16:29:33 (GMT)
commit30e3ea4c79dd35e97d04546bd39e2468c8ba63ef (patch)
treeaaf21a0fe2ef03fab34db72f79eaa30e58e6058d /drivers
parentb748b24fb504b4da630c6464d6704ae7758f3732 (diff)
downloadu-boot-30e3ea4c79dd35e97d04546bd39e2468c8ba63ef.tar.xz
dfu: dfu_sf: Pass duplicate devstr to parse_dev
parse_dev() alters the string pointed by devstr parameter. Due to this subsequent parsing of sf entities will fail, as string pointed by devstr is no longer valid sf dev arguments. Fix this by passing pointer to the copy of the string to parse_dev instead of pointer to the actual devstr. Signed-off-by: Vignesh R <vigneshr@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/dfu/dfu_sf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 7646c6b..9702eee 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -115,8 +115,10 @@ static struct spi_flash *parse_dev(char *devstr)
int dfu_fill_entity_sf(struct dfu_entity *dfu, char *devstr, char *s)
{
char *st;
+ char *devstr_bkup = strdup(devstr);
- dfu->data.sf.dev = parse_dev(devstr);
+ dfu->data.sf.dev = parse_dev(devstr_bkup);
+ free(devstr_bkup);
if (!dfu->data.sf.dev)
return -ENODEV;