Message ID | 20221111144139.2420127-1-yangyingliang@huawei.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | [v2] scsi: scsi_transport_sas: fix error handling in sas_port_add() | expand |
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index accc0afa8f77..e090486258a5 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c @@ -959,7 +959,11 @@ int sas_port_add(struct sas_port *port) if (error) return error; - transport_add_device(&port->dev); + error = transport_add_device(&port->dev); + if (error) { + device_del(&port->dev); + return error; + } transport_configure_device(&port->dev); return 0;