mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
Update core.c
1:The control flow was simplified by using else if statements instead of goto structure. 2:Error conditions are handled more clearly. 3:The device_unlock call at the end of the function is guaranteed in all cases.
This commit is contained in:
parent
9852d85ec9
commit
5b036330b2
@ -40,27 +40,19 @@ int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name)
|
|||||||
|
|
||||||
if (dev->shutting_down) {
|
if (dev->shutting_down) {
|
||||||
rc = -ENODEV;
|
rc = -ENODEV;
|
||||||
goto error;
|
}else if (dev->dev_up) {
|
||||||
}
|
|
||||||
|
|
||||||
if (dev->dev_up) {
|
|
||||||
rc = -EBUSY;
|
rc = -EBUSY;
|
||||||
goto error;
|
}else if (!dev->ops->fw_download) {
|
||||||
}
|
|
||||||
|
|
||||||
if (!dev->ops->fw_download) {
|
|
||||||
rc = -EOPNOTSUPP;
|
rc = -EOPNOTSUPP;
|
||||||
goto error;
|
}else{
|
||||||
}
|
dev->fw_download_in_progress = true;
|
||||||
|
rc = dev->ops->fw_download(dev, firmware_name);
|
||||||
|
if (rc)
|
||||||
|
dev->fw_download_in_progress = false;
|
||||||
|
}
|
||||||
|
|
||||||
dev->fw_download_in_progress = true;
|
device_unlock(&dev->dev);
|
||||||
rc = dev->ops->fw_download(dev, firmware_name);
|
return rc;
|
||||||
if (rc)
|
|
||||||
dev->fw_download_in_progress = false;
|
|
||||||
|
|
||||||
error:
|
|
||||||
device_unlock(&dev->dev);
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user