Re: [PATCH 3/4] drivers/base: devres.c: use devm_kmemdup() from with devm_kstrdup()

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

 



On Thu, 2014-06-19 at 16:46 +0100, Rob Jones wrote:
> Avoid code duplication by using devm_kmemdup() to copy data instead
> of having a separate loop within devm_kstrdup().
> 
> Reviewed-by: Ian Molton <ian.molton@xxxxxxxxxxxxxxx>
> Signed-off-by: Rob Jones <rob.jones@xxxxxxxxxxxxxxx>
[]
> diff --git a/drivers/base/devres.c b/drivers/base/devres.c
[]
> @@ -802,17 +802,10 @@ EXPORT_SYMBOL_GPL(devm_kmalloc);
>   */
>  char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp)
>  {
[]
> +	return devm_kmemdup(dev, s, (strlen(s) + 1), gfp);
>  }
>  EXPORT_SYMBOL_GPL(devm_kstrdup);

Making this static inline in the header and dropping
EXPORT_SYMBOL_GPL might be smaller code.

static inline
char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp)
{
	return devm_kmemdup(dev, s, strlen(s) + 1, gfp);
}


--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux