Fix to return error code -ENOMEM from the memory or workqueue alloc error handling case instead of 0, as done elsewhere in this function.
Unified · Split
| @@ -839,6 +839,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 838 unmodified lines | ||
| 839 | 839 | dev->radio_tx_caps = V4L2_CAP_RDS_OUTPUT | V4L2_CAP_MODULATOR | |
| 840 | 840 | V4L2_CAP_READWRITE; |
| 841 | 841 | |
| 842 | + ret = -ENOMEM; | |
| 842 | 843 | /* initialize the test pattern generator */ |
| 843 | 844 | tpg_init(&dev->tpg, 640, 360); |
| 844 | 845 | if (tpg_alloc(&dev->tpg, MAX_ZOOM * MAX_WIDTH)) |
| @@ -1033,8 +1034,10 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) · 188 unmodified lines | ||
| 1033 | 1034 | */ |
| 1034 | 1035 | dev->cec_workqueue = |
| 1035 | 1036 | alloc_ordered_workqueue("vivid-%03d-cec", WQ_MEM_RECLAIM, inst); |
| 1036 | − if (!dev->cec_workqueue) | |
| 1037 | + if (!dev->cec_workqueue) { | |
| 1038 | + ret = -ENOMEM; | |
| 1037 | 1039 | goto unreg_dev; |
| 1040 | + } | |
| 1038 | 1041 | |
| 1039 | 1042 | /* start creating the vb2 queues */ |
| 1040 | 1043 | if (dev->has_vid_cap) { |