Re: [PATCH] gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx 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

-- 
Ville Syrjälä
Intel OTC
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]