Skip to content

Commit

Permalink
devres: constify p in devm_kfree()
Browse files Browse the repository at this point in the history
Make devm_kfree() signature uniform with that of kfree(). To avoid
compiler warnings: cast p to (void *) when calling devres_destroy().

Signed-off-by: Bartosz Golaszewski <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
Reviewed-by: Geert Uytterhoeven <[email protected]>
Acked-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
brgl authored and gregkh committed Oct 16, 2018
1 parent 8514c47 commit 0571967
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions drivers/base/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,12 @@ EXPORT_SYMBOL_GPL(devm_kasprintf);
*
* Free memory allocated with devm_kmalloc().
*/
void devm_kfree(struct device *dev, void *p)
void devm_kfree(struct device *dev, const void *p)
{
int rc;

rc = devres_destroy(dev, devm_kmalloc_release, devm_kmalloc_match, p);
rc = devres_destroy(dev, devm_kmalloc_release,
devm_kmalloc_match, (void *)p);
WARN_ON(rc);
}
EXPORT_SYMBOL_GPL(devm_kfree);
Expand Down
2 changes: 1 addition & 1 deletion include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ static inline void *devm_kcalloc(struct device *dev,
{
return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
}
extern void devm_kfree(struct device *dev, void *p);
extern void devm_kfree(struct device *dev, const void *p);
extern char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp) __malloc;
extern void *devm_kmemdup(struct device *dev, const void *src, size_t len,
gfp_t gfp);
Expand Down

0 comments on commit 0571967

Please sign in to comment.