openwrt/target/linux/bcm27xx/patches-6.6/950-0851-drivers-w1-gpio-Fixup-uninitialised-variable-use-in-.patch
Álvaro Fernández Rojas 8c405cdccc bcm27xx: add 6.6 kernel patches
The patches were generated from the RPi repo with the following command:
git format-patch v6.6.34..rpi-6.1.y

Some patches needed rebasing and, as usual, the applied and reverted, wireless
drivers, Github workflows, READMEs and defconfigs patches were removed.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2024-06-18 18:52:49 +02:00

38 lines
1.2 KiB
Diff

From d4ff364285a62c6a6302e8b95a0276b162590e4a Mon Sep 17 00:00:00 2001
From: Jonathan Bell <jonathan@raspberrypi.com>
Date: Wed, 24 Jan 2024 11:13:19 +0000
Subject: [PATCH 0851/1085] drivers: w1-gpio: Fixup uninitialised variable use
in w1_gpio_probe
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
---
drivers/w1/masters/w1-gpio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
--- a/drivers/w1/masters/w1-gpio.c
+++ b/drivers/w1/masters/w1-gpio.c
@@ -76,6 +76,11 @@ static int w1_gpio_probe(struct platform
enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
int err;
+ master = devm_kzalloc(dev, sizeof(struct w1_bus_master),
+ GFP_KERNEL);
+ if (!master)
+ return -ENOMEM;
+
if (of_have_populated_dt() && !dev_get_platdata(&pdev->dev)) {
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata)
@@ -102,11 +107,6 @@ static int w1_gpio_probe(struct platform
return -ENXIO;
}
- master = devm_kzalloc(dev, sizeof(struct w1_bus_master),
- GFP_KERNEL);
- if (!master)
- return -ENOMEM;
-
pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags);
if (IS_ERR(pdata->gpiod)) {
dev_err(dev, "gpio_request (pin) failed\n");