]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: ehea: unwind probe_port sysfs file on failure
authorPengpeng Hou <pengpeng@iscas.ac.cn>
Mon, 15 Jun 2026 07:00:31 +0000 (15:00 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 17 Jun 2026 23:33:39 +0000 (16:33 -0700)
ehea_create_device_sysfs() creates probe_port and then remove_port. If
the second device_create_file() fails, the helper returns the error but
leaves probe_port installed even though probe treats the sysfs setup as
failed.

Remove probe_port on the remove_port creation failure path so the helper
leaves no partial sysfs state behind.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20260615070033.43461-1-pengpeng@iscas.ac.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/ibm/ehea/ehea_main.c

index ff67c4fd66a3c605051e704bbef073aa65a66be0..bfc8699a05b944b95728cb05577bdb144f94b665 100644 (file)
@@ -3216,6 +3216,8 @@ static int ehea_create_device_sysfs(struct platform_device *dev)
                goto out;
 
        ret = device_create_file(&dev->dev, &dev_attr_remove_port);
+       if (ret)
+               device_remove_file(&dev->dev, &dev_attr_probe_port);
 out:
        return ret;
 }