Skip to content

Commit e1a8b8b

Browse files
committed
drivers: w1-gpio: Fixup uninitialised variable use in w1_gpio_probe
Signed-off-by: Jonathan Bell <[email protected]>
1 parent 6fe0063 commit e1a8b8b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/w1/masters/w1-gpio.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@ static int w1_gpio_probe(struct platform_device *pdev)
7676
enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN;
7777
int err;
7878

79+
master = devm_kzalloc(dev, sizeof(struct w1_bus_master),
80+
GFP_KERNEL);
81+
if (!master)
82+
return -ENOMEM;
83+
7984
if (of_have_populated_dt()) {
8085
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
8186
if (!pdata)
@@ -102,11 +107,6 @@ static int w1_gpio_probe(struct platform_device *pdev)
102107
return -ENXIO;
103108
}
104109

105-
master = devm_kzalloc(dev, sizeof(struct w1_bus_master),
106-
GFP_KERNEL);
107-
if (!master)
108-
return -ENOMEM;
109-
110110
pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags);
111111
if (IS_ERR(pdata->gpiod)) {
112112
dev_err(dev, "gpio_request (pin) failed\n");

0 commit comments

Comments
 (0)