linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] i2c: small fixes for eg20t
@ 2012-04-20 20:45 Wolfram Sang
       [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:45 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Tomoya MORINAGA, Wolfram Sang

These flaws were found by code-checkers and I think they are right.

Wolfram Sang (4):
  i2c: eg20t: use NULL instead of 0
  i2c: eg20t: pass on return value in i2c_xfer
  i2c: eg20t: remove unused function
  i2c: eg20t: don't use strcpy but strlcpy

 drivers/i2c/busses/i2c-eg20t.c |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

-- 
1.7.10

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

* [PATCH 1/4] i2c: eg20t: use NULL instead of 0
       [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-04-20 20:45   ` Wolfram Sang
  2012-04-20 20:45   ` [PATCH 2/4] i2c: eg20t: pass on return value in i2c_xfer Wolfram Sang
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:45 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Tomoya MORINAGA, Wolfram Sang

From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

sparse rightfully says:
drivers/i2c/busses/i2c-eg20t.c:990:59: warning: Using plain integer as NULL pointer

Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-eg20t.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 9da12ce..6e9e075 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -872,7 +872,7 @@ static void __devexit pch_i2c_remove(struct pci_dev *pdev)
 		pci_iounmap(pdev, adap_info->pch_data[0].pch_base_address);
 
 	for (i = 0; i < adap_info->ch_num; i++)
-		adap_info->pch_data[i].pch_base_address = 0;
+		adap_info->pch_data[i].pch_base_address = NULL;
 
 	pci_set_drvdata(pdev, NULL);
 
-- 
1.7.10

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

* [PATCH 2/4] i2c: eg20t: pass on return value in i2c_xfer
       [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2012-04-20 20:45   ` [PATCH 1/4] i2c: eg20t: use NULL instead of 0 Wolfram Sang
@ 2012-04-20 20:45   ` Wolfram Sang
  2012-04-20 20:45   ` [PATCH 3/4] i2c: eg20t: remove unused function Wolfram Sang
  2012-04-20 20:45   ` [PATCH 4/4] i2c: eg20t: don't use strcpy but strlcpy Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:45 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Tomoya MORINAGA, Wolfram Sang

From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

smatch says:
drivers/i2c/busses/i2c-eg20t.c:702 pch_i2c_xfer() info: why not propagate 'ret' from mutex_lock_interruptible() instead of -512?

which is especially true since for -ENORESTARTSYS it is said in
linux/errno.h "signal_pending() MUST be set" which is not done here. So
just pass on the return value we got.

Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-eg20t.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 6e9e075..93926a7 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -699,7 +699,7 @@ static s32 pch_i2c_xfer(struct i2c_adapter *i2c_adap,
 
 	ret = mutex_lock_interruptible(&pch_mutex);
 	if (ret)
-		return -ERESTARTSYS;
+		return ret;
 
 	if (adap->p_adapter_info->pch_i2c_suspended) {
 		mutex_unlock(&pch_mutex);
-- 
1.7.10

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

* [PATCH 3/4] i2c: eg20t: remove unused function
       [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2012-04-20 20:45   ` [PATCH 1/4] i2c: eg20t: use NULL instead of 0 Wolfram Sang
  2012-04-20 20:45   ` [PATCH 2/4] i2c: eg20t: pass on return value in i2c_xfer Wolfram Sang
@ 2012-04-20 20:45   ` Wolfram Sang
  2012-04-20 20:45   ` [PATCH 4/4] i2c: eg20t: don't use strcpy but strlcpy Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:45 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Tomoya MORINAGA, Wolfram Sang

From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

cppcheck rightfully says:
drivers/i2c/busses/i2c-eg20t.c:266: style: The function 'ktime_lt' is never used

Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-eg20t.c |    5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 93926a7..5441e69 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -263,11 +263,6 @@ static void pch_i2c_init(struct i2c_algo_pch_data *adap)
 	init_waitqueue_head(&pch_event);
 }
 
-static inline bool ktime_lt(const ktime_t cmp1, const ktime_t cmp2)
-{
-	return cmp1.tv64 < cmp2.tv64;
-}
-
 /**
  * pch_i2c_wait_for_bus_idle() - check the status of bus.
  * @adap:	Pointer to struct i2c_algo_pch_data.
-- 
1.7.10

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

* [PATCH 4/4] i2c: eg20t: don't use strcpy but strlcpy
       [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
                     ` (2 preceding siblings ...)
  2012-04-20 20:45   ` [PATCH 3/4] i2c: eg20t: remove unused function Wolfram Sang
@ 2012-04-20 20:45   ` Wolfram Sang
  3 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2012-04-20 20:45 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Tomoya MORINAGA, Wolfram Sang

From: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>

Signed-off-by: Wolfram Sang <wolfram-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Tomoya MORINAGA <tomoya.rohm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-eg20t.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c
index 5441e69..2f74ae8 100644
--- a/drivers/i2c/busses/i2c-eg20t.c
+++ b/drivers/i2c/busses/i2c-eg20t.c
@@ -813,7 +813,7 @@ static int __devinit pch_i2c_probe(struct pci_dev *pdev,
 
 		pch_adap->owner = THIS_MODULE;
 		pch_adap->class = I2C_CLASS_HWMON;
-		strcpy(pch_adap->name, KBUILD_MODNAME);
+		strlcpy(pch_adap->name, KBUILD_MODNAME, sizeof(pch_adap->name));
 		pch_adap->algo = &pch_algorithm;
 		pch_adap->algo_data = &adap_info->pch_data[i];
 
-- 
1.7.10

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

end of thread, other threads:[~2012-04-20 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-20 20:45 [PATCH 0/4] i2c: small fixes for eg20t Wolfram Sang
     [not found] ` <1334954717-13146-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-04-20 20:45   ` [PATCH 1/4] i2c: eg20t: use NULL instead of 0 Wolfram Sang
2012-04-20 20:45   ` [PATCH 2/4] i2c: eg20t: pass on return value in i2c_xfer Wolfram Sang
2012-04-20 20:45   ` [PATCH 3/4] i2c: eg20t: remove unused function Wolfram Sang
2012-04-20 20:45   ` [PATCH 4/4] i2c: eg20t: don't use strcpy but strlcpy Wolfram Sang

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).