firmware: arm_scmi: Fix devres allocation device in virtio transport
authorCristian Marussi <cristian.marussi@arm.com>
Fri, 28 Oct 2022 14:08:30 +0000 (15:08 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Tue, 1 Nov 2022 11:35:45 +0000 (11:35 +0000)
SCMI virtio transport device managed allocations must use the main
platform device in devres operations instead of the channel devices.

Cc: Peter Hilber <peter.hilber@opensynergy.com>
Fixes: 46abe13b5e3d ("firmware: arm_scmi: Add virtio transport")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20221028140833.280091-5-cristian.marussi@arm.com
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/virtio.c

index 14709db..36b7686 100644 (file)
@@ -444,12 +444,12 @@ static int virtio_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
        for (i = 0; i < vioch->max_msg; i++) {
                struct scmi_vio_msg *msg;
 
-               msg = devm_kzalloc(cinfo->dev, sizeof(*msg), GFP_KERNEL);
+               msg = devm_kzalloc(dev, sizeof(*msg), GFP_KERNEL);
                if (!msg)
                        return -ENOMEM;
 
                if (tx) {
-                       msg->request = devm_kzalloc(cinfo->dev,
+                       msg->request = devm_kzalloc(dev,
                                                    VIRTIO_SCMI_MAX_PDU_SIZE,
                                                    GFP_KERNEL);
                        if (!msg->request)
@@ -458,7 +458,7 @@ static int virtio_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
                        refcount_set(&msg->users, 1);
                }
 
-               msg->input = devm_kzalloc(cinfo->dev, VIRTIO_SCMI_MAX_PDU_SIZE,
+               msg->input = devm_kzalloc(dev, VIRTIO_SCMI_MAX_PDU_SIZE,
                                          GFP_KERNEL);
                if (!msg->input)
                        return -ENOMEM;