[PATCH 1/1] m88ts2022: return the err code in its probe function when error occurs.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



if "chip_id" is wrong or "dev->cfg.clock_out" is invalid, the i2c model is still loaded.
It will cause "kernel NULL pointer dereference" oops when the i2c model remove.
returning the err code will prevent the i2c model load. 

Signed-off-by: Nibble Max <nibble.max@xxxxxxxxx>
---
 drivers/media/tuners/m88ts2022.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c
index caa5423..066e543 100644
--- a/drivers/media/tuners/m88ts2022.c
+++ b/drivers/media/tuners/m88ts2022.c
@@ -488,6 +488,7 @@ static int m88ts2022_probe(struct i2c_client *client,
 	case 0x83:
 		break;
 	default:
+		ret = -ENODEV;
 		goto err;
 	}
 
@@ -505,6 +506,7 @@ static int m88ts2022_probe(struct i2c_client *client,
 		u8tmp = 0x6c;
 		break;
 	default:
+		ret = -EINVAL;
 		goto err;
 	}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux