public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drivers/rtc/rtc-bq32k.c: remove redundant check
@ 2015-07-08  6:56 Maninder Singh
  2015-07-14 22:41 ` Alexandre Belloni
  0 siblings, 1 reply; 2+ messages in thread
From: Maninder Singh @ 2015-07-08  6:56 UTC (permalink / raw)
  To: a.zummo, alexandre.belloni, rtc-linux, linux-kernel
  Cc: pankaj.m, Maninder Singh

removing below static analysis error:-
(error) Possible null pointer dereference: client

if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
							^^^^^^^
Error comes beacause client is dereferenced before NULL check.
So probabily NULL this check is not required.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
---
 drivers/rtc/rtc-bq32k.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index 92679df..409de9f 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -212,7 +212,7 @@ static int bq32k_probe(struct i2c_client *client,
 	if (error)
 		return error;
 
-	if (client && client->dev.of_node)
+	if (client->dev.of_node)
 		trickle_charger_of_init(dev, client->dev.of_node);
 
 	rtc = devm_rtc_device_register(&client->dev, bq32k_driver.driver.name,
-- 
1.7.9.5


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

* Re: [PATCH 1/1] drivers/rtc/rtc-bq32k.c: remove redundant check
  2015-07-08  6:56 [PATCH 1/1] drivers/rtc/rtc-bq32k.c: remove redundant check Maninder Singh
@ 2015-07-14 22:41 ` Alexandre Belloni
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Belloni @ 2015-07-14 22:41 UTC (permalink / raw)
  To: Maninder Singh; +Cc: a.zummo, rtc-linux, linux-kernel, pankaj.m

Hi,

On 08/07/2015 at 12:26:47 +0530, Maninder Singh wrote :
> removing below static analysis error:-

What tool did you use?

> (error) Possible null pointer dereference: client
> 
> if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> 							^^^^^^^
> Error comes beacause client is dereferenced before NULL check.
> So probabily NULL this check is not required.
> 
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> ---
>  drivers/rtc/rtc-bq32k.c |    2 +-
Applied, to rtc-next.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2015-07-14 22:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-08  6:56 [PATCH 1/1] drivers/rtc/rtc-bq32k.c: remove redundant check Maninder Singh
2015-07-14 22:41 ` Alexandre Belloni

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