linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe()
@ 2021-07-10  2:22 Sasha Levin
  2021-07-10  2:24 ` [PATCH AUTOSEL 5.10 87/93] leds: turris-omnia: add missing MODULE_DEVICE_TABLE Sasha Levin
  2021-07-12 21:48 ` [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Pavel Machek
  0 siblings, 2 replies; 3+ messages in thread
From: Sasha Levin @ 2021-07-10  2:22 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Yang Yingliang, Hulk Robot, Pavel Machek, Sasha Levin, linux-leds

From: Yang Yingliang <yangyingliang@huawei.com>

[ Upstream commit ee522bcf026ec82ada793979c3a906274430595a ]

After device_get_match_data(), tlc591xx is not checked, add
check for it and also check np after dev_of_node.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/leds/leds-tlc591xx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/leds-tlc591xx.c b/drivers/leds/leds-tlc591xx.c
index 5b9dfdf743ec..cb7bd1353f9f 100644
--- a/drivers/leds/leds-tlc591xx.c
+++ b/drivers/leds/leds-tlc591xx.c
@@ -148,16 +148,20 @@ static int
 tlc591xx_probe(struct i2c_client *client,
 	       const struct i2c_device_id *id)
 {
-	struct device_node *np = dev_of_node(&client->dev), *child;
+	struct device_node *np, *child;
 	struct device *dev = &client->dev;
 	const struct tlc591xx *tlc591xx;
 	struct tlc591xx_priv *priv;
 	int err, count, reg;
 
-	tlc591xx = device_get_match_data(dev);
+	np = dev_of_node(dev);
 	if (!np)
 		return -ENODEV;
 
+	tlc591xx = device_get_match_data(dev);
+	if (!tlc591xx)
+		return -ENODEV;
+
 	count = of_get_available_child_count(np);
 	if (!count || count > tlc591xx->max_leds)
 		return -EINVAL;
-- 
2.30.2


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

* [PATCH AUTOSEL 5.10 87/93] leds: turris-omnia: add missing MODULE_DEVICE_TABLE
  2021-07-10  2:22 [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Sasha Levin
@ 2021-07-10  2:24 ` Sasha Levin
  2021-07-12 21:48 ` [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Pavel Machek
  1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2021-07-10  2:24 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Zou Wei, Hulk Robot, Pavel Machek, Sasha Levin, linux-leds

From: Zou Wei <zou_wei@huawei.com>

[ Upstream commit 9d0150db97583cfbb6b44cbe02241a1a48f90210 ]

This patch adds missing MODULE_DEVICE_TABLE definition which generates
correct modalias for automatic loading of this driver when it is built
as an external module.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/leds/leds-turris-omnia.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/leds/leds-turris-omnia.c b/drivers/leds/leds-turris-omnia.c
index 880fc8def530..ec87a958f151 100644
--- a/drivers/leds/leds-turris-omnia.c
+++ b/drivers/leds/leds-turris-omnia.c
@@ -277,6 +277,7 @@ static const struct i2c_device_id omnia_id[] = {
 	{ "omnia", 0 },
 	{ }
 };
+MODULE_DEVICE_TABLE(i2c, omnia_id);
 
 static struct i2c_driver omnia_leds_driver = {
 	.probe		= omnia_leds_probe,
-- 
2.30.2


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

* Re: [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe()
  2021-07-10  2:22 [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Sasha Levin
  2021-07-10  2:24 ` [PATCH AUTOSEL 5.10 87/93] leds: turris-omnia: add missing MODULE_DEVICE_TABLE Sasha Levin
@ 2021-07-12 21:48 ` Pavel Machek
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2021-07-12 21:48 UTC (permalink / raw)
  To: Sasha Levin; +Cc: linux-kernel, stable, Yang Yingliang, Hulk Robot, linux-leds

[-- Attachment #1: Type: text/plain, Size: 711 bytes --]

Hi!

> [ Upstream commit ee522bcf026ec82ada793979c3a906274430595a ]
> 
> After device_get_match_data(), tlc591xx is not checked, add
> check for it and also check np after dev_of_node.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> Signed-off-by: Pavel Machek <pavel@ucw.cz>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

This was found by code review, is not known to cause real problems,
and received very little testing. Please drop it from stable.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

end of thread, other threads:[~2021-07-12 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-10  2:22 [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Sasha Levin
2021-07-10  2:24 ` [PATCH AUTOSEL 5.10 87/93] leds: turris-omnia: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-07-12 21:48 ` [PATCH AUTOSEL 5.10 01/93] leds: tlc591xx: fix return value check in tlc591xx_probe() Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).