Merge "coresight: tmc: avoid null pointer dereference"
This commit is contained in:
commit
f505d0d4f0
1 changed files with 11 additions and 7 deletions
|
@ -792,11 +792,14 @@ static int tmc_enable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
|
||||||
drvdata->out_mode == TMC_ETR_OUT_MODE_USB) {
|
drvdata->out_mode == TMC_ETR_OUT_MODE_USB) {
|
||||||
drvdata->usbch = usb_qdss_open("qdss", drvdata,
|
drvdata->usbch = usb_qdss_open("qdss", drvdata,
|
||||||
usb_notifier);
|
usb_notifier);
|
||||||
if (IS_ERR(drvdata->usbch)) {
|
if (IS_ERR_OR_NULL(drvdata->usbch)) {
|
||||||
dev_err(drvdata->dev, "usb_qdss_open failed\n");
|
dev_err(drvdata->dev, "usb_qdss_open failed\n");
|
||||||
ret = PTR_ERR(drvdata->usbch);
|
ret = PTR_ERR(drvdata->usbch);
|
||||||
pm_runtime_put(drvdata->dev);
|
pm_runtime_put(drvdata->dev);
|
||||||
mutex_unlock(&drvdata->mem_lock);
|
mutex_unlock(&drvdata->mem_lock);
|
||||||
|
if (!ret)
|
||||||
|
ret = -ENODEV;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
} else if (drvdata->config_type == TMC_CONFIG_TYPE_ETB ||
|
} else if (drvdata->config_type == TMC_CONFIG_TYPE_ETB ||
|
||||||
|
@ -1846,12 +1849,13 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
|
||||||
struct device_node *np = adev->dev.of_node;
|
struct device_node *np = adev->dev.of_node;
|
||||||
struct coresight_cti_data *ctidata;
|
struct coresight_cti_data *ctidata;
|
||||||
|
|
||||||
if (np) {
|
if (!np)
|
||||||
pdata = of_get_coresight_platform_data(dev, np);
|
return -ENODEV;
|
||||||
if (IS_ERR(pdata))
|
|
||||||
return PTR_ERR(pdata);
|
pdata = of_get_coresight_platform_data(dev, np);
|
||||||
adev->dev.platform_data = pdata;
|
if (IS_ERR(pdata))
|
||||||
}
|
return PTR_ERR(pdata);
|
||||||
|
adev->dev.platform_data = pdata;
|
||||||
|
|
||||||
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
|
drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
|
||||||
if (!drvdata)
|
if (!drvdata)
|
||||||
|
|
Loading…
Add table
Reference in a new issue