mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 1/1] mux: mux-core: Add NULL check for dev->of_node
@ 2017-07-07 21:46 sathyanarayanan.kuppuswamy
  2017-07-08 21:00 ` Peter Rosin
  0 siblings, 1 reply; 8+ messages in thread
From: sathyanarayanan.kuppuswamy @ 2017-07-07 21:46 UTC (permalink / raw)
  To: peda; +Cc: linux-kernel, sathyaosid, Kuppuswamy Sathyanarayanan

From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

If dev->of_node is NULL, then calling mux_control_get()
function can lead to NULL pointer exception. So adding
a NULL check for dev->of_node.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
 drivers/mux/mux-core.c | 3 +++
 1 file changed, 3 insertions(+)

Changes since v1:
 * Removed dummy new line.

diff --git a/drivers/mux/mux-core.c b/drivers/mux/mux-core.c
index 90b8995..924c983 100644
--- a/drivers/mux/mux-core.c
+++ b/drivers/mux/mux-core.c
@@ -438,6 +438,9 @@ struct mux_control *mux_control_get(struct device *dev, const char *mux_name)
 	int index = 0;
 	int ret;
 
+	if (!np)
+		return ERR_PTR(-ENODEV);
+
 	if (mux_name) {
 		index = of_property_match_string(np, "mux-control-names",
 						 mux_name);
-- 
2.7.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-07-12  9:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07 21:46 [PATCH v2 1/1] mux: mux-core: Add NULL check for dev->of_node sathyanarayanan.kuppuswamy
2017-07-08 21:00 ` Peter Rosin
2017-07-08 23:12   ` Kuppuswamy, Sathyanarayanan
2017-07-09  7:07     ` Peter Rosin
2017-07-09  7:35       ` Kuppuswamy, Sathyanarayanan
2017-07-10  7:40         ` Peter Rosin
2017-07-10 21:36           ` sathyanarayanan kuppuswamy
2017-07-12  9:14             ` Peter Rosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®