All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] m88ts2022: return the err code in its probe function when error occurs.
@ 2014-10-23 13:36 Nibble Max
  0 siblings, 0 replies; only message in thread
From: Nibble Max @ 2014-10-23 13:36 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: linux-media

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-23 13:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-23 13:36 [PATCH 1/1] m88ts2022: return the err code in its probe function when error occurs Nibble Max

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.