Commit daf7995a authored by Federico Vaga's avatar Federico Vaga

sw:drv: improvements form cppcheck

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent e24273e4
......@@ -158,11 +158,10 @@ static int gn4124_fpga_fcl_init(struct spec_dev *spec, int last_word_size)
static int gn4124_fpga_fcl_waitdone(struct spec_dev *spec)
{
unsigned long j;
uint32_t val;
j = jiffies + 2 * HZ;
while (1) {
val = gennum_readl(spec, FCL_IRQ);
uint32_t val = gennum_readl(spec, FCL_IRQ);
/* Done */
if (val & 0x8)
......@@ -192,13 +191,13 @@ static int gn4124_fpga_fcl_waitdone(struct spec_dev *spec)
static int gn4124_fpga_load(struct spec_dev *spec, const void *data, int len)
{
int size32 = (len + 3) >> 2;
int done = 0, wrote = 0, i;
int done = 0, wrote = 0;
const uint32_t *data32 = data;
while(size32 > 0)
{
/* Check to see if FPGA configuation has error */
i = gennum_readl(spec, FCL_IRQ);
int i = gennum_readl(spec, FCL_IRQ);
if ( (i & 8) && wrote) {
done = 1;
printk("%s: %i: done after %i\n", __func__, __LINE__,
......
......@@ -207,10 +207,9 @@ out_enable_irq:
static irqreturn_t spec_irq_sw_handler(int irq, void *arg)
{
struct spec_dev *spec = arg;
uint32_t int_stat;
/* Ack the interrupts */
int_stat = gennum_readl(spec, GNINT_STAT);
gennum_readl(spec, GNINT_STAT);
gennum_writel(spec, 0x0000, GNINT_STAT);
complete(&spec->compl);
......@@ -365,13 +364,13 @@ static int spec_irq_sw_test(struct spec_dev *spec)
*/
int spec_irq_init(struct spec_dev *spec)
{
int irq = to_pci_dev(spec->dev.parent)->irq;
int err;
int i;
int irq, err, i;
if (!spec)
return -EINVAL;
irq = to_pci_dev(spec->dev.parent)->irq;
/* disable all source of interrupts */
for (i = 0; i < 7; i++)
gennum_writel(spec, 0, GNINT_CFG(i));
......@@ -421,12 +420,13 @@ err_gpio:
void spec_irq_exit(struct spec_dev *spec)
{
int i;
int irq = to_pci_dev(spec->dev.parent)->irq;
int i, irq;
if (!spec)
return;
irq = to_pci_dev(spec->dev.parent)->irq;
/* disable all source of interrupts */
for (i = 0; i < 7; i++)
gennum_writel(spec, 0, GNINT_CFG(i));
......
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