Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sound/soc/sof/sof-pci-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ int sof_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)

dev_dbg(&pci->dev, "PCI DSP detected");

if (!desc) {
dev_err(dev, "error: no matching PCI descriptor\n");
return -ENODEV;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajitkupandey this can only happen if you add a PCI_DEVICE without the matching .driver_data set, right? That's typically only in developer workspaces, and even then that's pretty bad, isn't it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this happens only when .driver_data isn't set in pci driver. Actually i ended up in this exception once due to missing driver data so thought to fix this one. I agree that's pretty bad and part of developer workspace only but I guess avoiding exceptions in core code is always good.
If this double NULL check looks weird here may be fixup like adding a "pci_id->driver_data" NULL check in sof pci device probe like "hda_pci_intel_probe" before invoking sof_pci_probe can be done to avoid such exceptions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to do it here, just that you should add in the commit message that this is a paranoia check for something that should not happen for an actual released product.

if (!desc->ops) {
dev_err(dev, "error: no matching PCI descriptor ops\n");
return -ENODEV;
Expand Down