Skip to content

Commit 709318c

Browse files
pelwellYafen
authored and
Yafen
committed
misc: rp1-pio: Error out on incompatible firmware
If the RP1 firmware has reported an error then return that from the PIO probe function, otherwise defer the probing. Link: raspberrypi/linux#6642 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent f5b204c commit 709318c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/misc/rp1-pio.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -1277,8 +1277,10 @@ static int rp1_pio_probe(struct platform_device *pdev)
12771277
return dev_err_probe(dev, pdev->id, "alias is missing\n");
12781278

12791279
fw = devm_rp1_firmware_get(dev, dev->of_node);
1280-
if (IS_ERR_OR_NULL(fw))
1281-
return dev_err_probe(dev, -ENOENT, "failed to contact RP1 firmware\n");
1280+
if (!fw)
1281+
return dev_err_probe(dev, -EPROBE_DEFER, "failed to find RP1 firmware driver\n");
1282+
if (IS_ERR(fw))
1283+
return dev_err_probe(dev, PTR_ERR(fw), "failed to contact RP1 firmware\n");
12821284
ret = rp1_firmware_get_feature(fw, FOURCC_PIO, &op_base, &op_count);
12831285
if (ret < 0)
12841286
return ret;
@@ -1355,6 +1357,11 @@ static void rp1_pio_remove(struct platform_device *pdev)
13551357

13561358
if (g_pio == pio)
13571359
g_pio = NULL;
1360+
1361+
device_destroy(pio->dev_class, pio->dev_num);
1362+
cdev_del(&pio->cdev);
1363+
class_destroy(pio->dev_class);
1364+
unregister_chrdev_region(pio->dev_num, 1);
13581365
}
13591366

13601367
static const struct of_device_id rp1_pio_ids[] = {

0 commit comments

Comments
 (0)