Commit fcbce05c authored by Federico Vaga's avatar Federico Vaga

kernel: fix mem leakage

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 68fac77a
...@@ -131,12 +131,7 @@ int fd_probe(struct fmc_device *fmc) ...@@ -131,12 +131,7 @@ int fd_probe(struct fmc_device *fmc)
char *fwname; char *fwname;
int i, index, ret, ch; int i, index, ret, ch;
fd = kzalloc(sizeof(*fd), GFP_KERNEL); /* Validate the new FMC device */
if (!fd) {
dev_err(dev, "can't allocate device\n");
return -ENOMEM;
}
index = fmc->op->validate(fmc, &fd_drv); index = fmc->op->validate(fmc, &fd_drv);
if (index < 0) { if (index < 0) {
dev_info(dev, "not using \"%s\" according to " dev_info(dev, "not using \"%s\" according to "
...@@ -144,6 +139,12 @@ int fd_probe(struct fmc_device *fmc) ...@@ -144,6 +139,12 @@ int fd_probe(struct fmc_device *fmc)
return -ENODEV; return -ENODEV;
} }
fd = devm_kzalloc(&fmc->dev, sizeof(*fd), GFP_KERNEL);
if (!fd) {
dev_err(dev, "can't allocate device\n");
return -ENOMEM;
}
fwname = ""; fwname = "";
if (!strcmp(fmc->carrier_name, "SVEC")) if (!strcmp(fmc->carrier_name, "SVEC"))
......
...@@ -324,7 +324,7 @@ int fd_irq_init(struct fd_dev *fd) ...@@ -324,7 +324,7 @@ int fd_irq_init(struct fd_dev *fd)
if (rv < 0) { if (rv < 0) {
dev_err(&fd->fmc->dev, dev_err(&fd->fmc->dev,
"Failed to request the VIC interrupt\n"); "Failed to request the VIC interrupt\n");
return rv; goto out_irq_request;
} }
/* /*
...@@ -344,6 +344,10 @@ int fd_irq_init(struct fd_dev *fd) ...@@ -344,6 +344,10 @@ int fd_irq_init(struct fd_dev *fd)
fd_writel(fd, FD_GCR_INPUT_EN, FD_REG_GCR); fd_writel(fd, FD_GCR_INPUT_EN, FD_REG_GCR);
return 0; return 0;
out_irq_request:
kfree(fd->sw_fifo.t);
return rv;
} }
void fd_irq_exit(struct fd_dev *fd) void fd_irq_exit(struct fd_dev *fd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment