Skip to contentSkip to conversation

staging: most: hdm-dim2: Remove possible dereference error

PATCH Superseded Amitoj Kaur Chawla 1 participant 2 messages Mar 18, 2016 1 message not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: most: hdm-dim2: Remove possible dereference error

Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with devm_request_irq") introduced the following static checker warning:
drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe()
error: 'dev->netinfo_task' dereferencing possible ERR_PTR()

Remove the warning by returning PTR_ERR immediately rather than storing in a variable and returning at the end of the function since we do not need to free anything.

---
 drivers/staging/most/hdm-dim2/dim2_hdm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/most/hdm-dim2/dim2_hdm.c +1 -1
index 0dc86ad..a364495 100644
@@ -771,7 +771,7 @@ static int dim2_probe(struct platform_device *pdev)
 	dev->netinfo_task = kthread_run(&deliver_netinfo_thread, (void *)dev,
 					"dim2_netinfo");
 	if (IS_ERR(dev->netinfo_task))
-		ret = PTR_ERR(dev->netinfo_task);
+		return PTR_ERR(dev->netinfo_task);
 
 	for (i = 0; i < DMA_CHANNELS; i++) {
 		struct most_channel_capability *cap = dev->capabilities + i;
Signature · 1 line
1.9.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 10 lines · Andrey Shvetsov
Quoted 9 lines · Amitoj Kaur Chawla

Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with devm_request_irq") introduced the following static checker warning:
drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe()
error: 'dev->netinfo_task' dereferencing possible ERR_PTR()

Remove the warning by returning PTR_ERR immediately rather than storing in a variable and returning at the end of the function since we do not need to free anything.

Quoted 8 lines

This patch is not about a warning.

This patch fixes the bug introduced in the previous patch that has changed the control flow so that the error code returned by the kthread_run was overwritten by the "ret = dim2_sysfs_probe" below.

regards
andy

I'll revise the commit message and resend.

Thanks,
Amitoj