kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/3] Input: cyttsp4 - silence NULL dereference warning
@ 2013-07-02 21:41 Dan Carpenter
  2013-07-03 12:33 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-07-02 21:41 UTC (permalink / raw)
  To: Javier Martinez Canillas, Ferruh Yigit
  Cc: Dmitry Torokhov, linux-input, kernel-janitors

If "cd" were NULL then we would dereference it when we print the error
message.  Fortunately enough, it can't ever be NULL so we can remove
those lines.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
index 7aa4a34..851e3ff 100644
--- a/drivers/input/touchscreen/cyttsp4_core.c
+++ b/drivers/input/touchscreen/cyttsp4_core.c
@@ -1450,11 +1450,6 @@ static void cyttsp4_watchdog_work(struct work_struct *work)
 	u8 *mode;
 	int retval;
 
-	if (cd = NULL) {
-		dev_err(cd->dev, "%s: NULL context pointer\n", __func__);
-		return;
-	}
-
 	mutex_lock(&cd->system_lock);
 	retval = cyttsp4_load_status_regs(cd);
 	if (retval < 0) {

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

* Re: [patch 2/3] Input: cyttsp4 - silence NULL dereference warning
  2013-07-02 21:41 [patch 2/3] Input: cyttsp4 - silence NULL dereference warning Dan Carpenter
@ 2013-07-03 12:33 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2013-07-03 12:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Javier Martinez Canillas, Dmitry Torokhov, linux-input,
	kernel-janitors

On 07/03/2013 12:41 AM, Dan Carpenter wrote:
> If "cd" were NULL then we would dereference it when we print the error
> message.  Fortunately enough, it can't ever be NULL so we can remove
> those lines.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c
> index 7aa4a34..851e3ff 100644
> --- a/drivers/input/touchscreen/cyttsp4_core.c
> +++ b/drivers/input/touchscreen/cyttsp4_core.c
> @@ -1450,11 +1450,6 @@ static void cyttsp4_watchdog_work(struct work_struct *work)
>       u8 *mode;
>       int retval;
>
> -     if (cd = NULL) {
> -             dev_err(cd->dev, "%s: NULL context pointer\n", __func__);
> -             return;
> -     }
> -
>       mutex_lock(&cd->system_lock);
>       retval = cyttsp4_load_status_regs(cd);
>       if (retval < 0) {
You are right, cd dereference is wrong in error message.
And agree on removing block, cd will not be NULL in this context.

--

Thanks,
ferruh

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.

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

end of thread, other threads:[~2013-07-03 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-02 21:41 [patch 2/3] Input: cyttsp4 - silence NULL dereference warning Dan Carpenter
2013-07-03 12:33 ` Ferruh Yigit

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