mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 12:13:51 -04:00
gpio: ppc44x: use dev_name() for chip label
Replace devm_kasprintf() with dev_name() for the chip label. dev_name() returns a stable pointer to the device name, so the separate allocation and -ENOMEM check can be dropped. Using dev_name() seems to be common for GPIO labels. Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Linus Walleij <linusw@kernel.org> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260803223539.86303-9-rosenp@gmail.com
This commit is contained in:
committed by
Madhavan Srinivasan
parent
9c4d539d11
commit
98a39710fc
@@ -147,7 +147,6 @@ ppc44x_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
|
||||
static int ppc44x_gpio_probe(struct platform_device *ofdev)
|
||||
{
|
||||
struct device *dev = &ofdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct ppc44x_gpio __iomem *regs;
|
||||
struct ppc44x_gpio_chip *chip;
|
||||
struct gpio_generic_chip_config config;
|
||||
@@ -179,14 +178,11 @@ static int ppc44x_gpio_probe(struct platform_device *ofdev)
|
||||
return ret;
|
||||
|
||||
gc = &chip->chip.gc;
|
||||
gc->label = dev_name(dev);
|
||||
gc->parent = dev;
|
||||
gc->direction_input = ppc44x_gpio_dir_in;
|
||||
gc->direction_output = ppc44x_gpio_dir_out;
|
||||
|
||||
gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", np);
|
||||
if (!gc->label)
|
||||
return -ENOMEM;
|
||||
|
||||
return devm_gpiochip_add_data(dev, gc, chip);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user