Skip to content

Commit

Permalink
gpu: drm: xylon: Return error if i2c client driver is NULL
Browse files Browse the repository at this point in the history
Return error if i2c_client driver instance is NULL.
Incase i2c encoder(adv7511) probe fails not checking
it will result in NULL pointer dereference.

<snip>
Unable to handle kernel NULL pointer dereference at virtual address 00000050
pgd = 40004000
[00000050] *pgd=00000000
Internal error: Oops - BUG: 17 [parallella#1] PREEMPT SMP ARM
Modules linked in:
CPU: 0 PID: 690 Comm: kworker/u4:2 Not tainted 3.19.0-xilinx-13711-g2b55e97-dirty analogdevicesinc#49
Hardware name: Xilinx Zynq Platform
Workqueue: deferwq deferred_probe_work_func
task: 771ab100 ti: 72a42000 task.ti: 72a42000
PC is at xylon_drm_encoder_create+0xf4/0x188
LR is at xylon_drm_encoder_create+0xf4/0x188

Signed-off-by: Radhey Shyam Pandey <radheys@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Tested-by: Christian Kohn <christian.kohn@xilinx.com>
  • Loading branch information
radheyxilinx authored and Michal Simek committed May 22, 2015
1 parent e19a2c3 commit 64e0529
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/xylon/xylon_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ struct drm_encoder *xylon_drm_encoder_create(struct drm_device *dev)

encoder->client = of_find_i2c_device_by_node(sub_node);
of_node_put(sub_node);
if (!encoder->client) {
if (!encoder->client || !encoder->client->dev.driver) {
DRM_INFO("failed find encoder\n");
return ERR_PTR(-EPROBE_DEFER);
}
Expand Down

0 comments on commit 64e0529

Please sign in to comment.