dev_err(dev, "Property 'cooling-levels' cannot be read.\n");
                return ret;
        }
-       snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%s%d", child->name, pwm_port);
+       snprintf(cdev->name, MAX_CDEV_NAME_LEN, "%pOFn%d", child, pwm_port);
 
        cdev->tcdev = thermal_of_cooling_device_register(child,
                                                         cdev->name,
 
                if (of_property_read_u32(np, "sensor-id", &sensor_id) &&
                    of_property_read_u32(np, "sensor-data", &sensor_id)) {
                        dev_info(&pdev->dev,
-                                "'sensor-id' missing in the node '%s'\n",
-                                np->name);
+                                "'sensor-id' missing in the node '%pOFn'\n",
+                                np);
                        continue;
                }
 
 
        int in_i = 1, temp_i = 1, curr_i = 1, humidity_i = 1;
        enum iio_chan_type type;
        struct iio_channel *channels;
-       const char *name = "iio_hwmon";
        struct device *hwmon_dev;
        char *sname;
 
-       if (dev->of_node && dev->of_node->name)
-               name = dev->of_node->name;
-
        channels = devm_iio_channel_get_all(dev);
        if (IS_ERR(channels)) {
                if (PTR_ERR(channels) == -ENODEV)
        st->attr_group.attrs = st->attrs;
        st->groups[0] = &st->attr_group;
 
-       sname = devm_kstrdup(dev, name, GFP_KERNEL);
+       if (dev->of_node)
+               sname = devm_kasprintf(dev, GFP_KERNEL, "%pOFn", dev->of_node);
+       else
+               sname = devm_kstrdup(dev, "iio_hwmon", GFP_KERNEL);
        if (!sname)
                return -ENOMEM;
 
 
                dev_err(dev, "Property 'cooling-levels' cannot be read.\n");
                return ret;
        }
-       snprintf(cdev->name, THERMAL_NAME_LENGTH, "%s%d", child->name,
+       snprintf(cdev->name, THERMAL_NAME_LENGTH, "%pOFn%d", child,
                 pwm_port);
 
        cdev->tcdev = thermal_of_cooling_device_register(child,