Skip to contentSkip to conversation

atm/firestream: handle thrown error

PATCH New Jeff Garzik 1 participant 1 message Oct 10, 2006 ATM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm/firestream: handle thrown error

gcc emits the following warning:

drivers/atm/firestream.c: In function ‘fs_open’:
drivers/atm/firestream.c:870: warning: ‘tmc0’ may be used uninitialized in this function

This indicates a real bug. We should check make_rate() return value for potential errors.

---

 drivers/atm/firestream.c |    4 ++++
 1 file changed, 4 insertions(+)
drivers/atm/firestream.c +4 -0
index 40ab9b6..697ad82 100644
@@ -1002,6 +1002,10 @@ static int fs_open(struct atm_vcc *atm_v
 					r = ROUND_UP;
 				}
 				error = make_rate (pcr, r, &tmc0, NULL);
+				if (error) {
+					kfree(tc);
+					return error;
+				}
 			}
 			fs_dprintk (FS_DEBUG_OPEN, "pcr = %d.\n", pcr);
 		}