Message ID | 1460563836-1899-1-git-send-email-ville.syrjala@linux.intel.com |
---|---|
State | New |
Headers | show |
On Wed, Apr 13, 2016 at 07:10:36PM +0300, ville.syrjala@linux.intel.com wrote: > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > index 682070d20f00..6238ddb81709 100644 > --- a/drivers/gpio/gpiolib-acpi.c > +++ b/drivers/gpio/gpiolib-acpi.c > @@ -950,7 +950,7 @@ int acpi_gpio_count(struct device *dev, const char *con_id) > struct acpi_crs_lookup { > struct list_head node; > struct acpi_device *adev; > - const char *con_id; > + char *con_id; Why it cannot be left as const? > }; > > static DEFINE_MUTEX(acpi_crs_lookup_lock); > @@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) > lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); > if (lookup) { > lookup->adev = adev; > - lookup->con_id = con_id; > + lookup->con_id = kstrdup(con_id, GFP_KERNEL); > list_add_tail(&lookup->node, &acpi_crs_lookup_list); > } > } > -- > 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Apr 14, 2016 at 03:27:49PM +0300, Mika Westerberg wrote: > On Wed, Apr 13, 2016 at 07:10:36PM +0300, ville.syrjala@linux.intel.com wrote: > > diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c > > index 682070d20f00..6238ddb81709 100644 > > --- a/drivers/gpio/gpiolib-acpi.c > > +++ b/drivers/gpio/gpiolib-acpi.c > > @@ -950,7 +950,7 @@ int acpi_gpio_count(struct device *dev, const char *con_id) > > struct acpi_crs_lookup { > > struct list_head node; > > struct acpi_device *adev; > > - const char *con_id; > > + char *con_id; > > Why it cannot be left as const? I suppose it could. > > > }; > > > > static DEFINE_MUTEX(acpi_crs_lookup_lock); > > @@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) > > lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); > > if (lookup) { > > lookup->adev = adev; > > - lookup->con_id = con_id; > > + lookup->con_id = kstrdup(con_id, GFP_KERNEL); > > list_add_tail(&lookup->node, &acpi_crs_lookup_list); > > } > > } > > -- > > 2.7.4
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index 682070d20f00..6238ddb81709 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -950,7 +950,7 @@ int acpi_gpio_count(struct device *dev, const char *con_id) struct acpi_crs_lookup { struct list_head node; struct acpi_device *adev; - const char *con_id; + char *con_id; }; static DEFINE_MUTEX(acpi_crs_lookup_lock); @@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id) lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); if (lookup) { lookup->adev = adev; - lookup->con_id = con_id; + lookup->con_id = kstrdup(con_id, GFP_KERNEL); list_add_tail(&lookup->node, &acpi_crs_lookup_list); } }