Skip to contentSkip to conversation

Input: cyttsp4 - silence NULL dereference warning

PATCH Applied Dan Carpenter 2 participants 2 messages Jul 2, 2013 – Jul 3, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Input: cyttsp4 - silence NULL dereference warning

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.

drivers/input/touchscreen/cyttsp4_core.c +0 -5
index 7aa4a34..851e3ff 100644
@@ -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) {
#1 lore raw
Quoted 12 lines · Dan Carpenter

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.

drivers/input/touchscreen/cyttsp4_core.c +0 -0
index 7aa4a34..851e3ff 100644
@@ -1450,11 +1450,6 @@ static void cyttsp4_watchdog_work(struct work_struct *work)
      u8 *mode;

drivers/input/touchscreen/cyttsp4_core.c static void cyttsp4_watchdog_work(struct work_struct *work) · line 1455

Quoted 10 lines
drivers/input/touchscreen/cyttsp4_core.c +0 -5
      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.