openwrt/target/linux/bcm27xx/patches-6.6/950-0851-drivers-w1-gpio-Fixup-uninitialised-variable-use-in-.patch

38 lines
1.2 KiB
Diff
Raw Normal View History

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");