All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yongjun_wei@trendmicro.com.cn
Cc: Richard Weinberger <richard@nod.at>, linux-mtd@lists.infradead.org
Subject: [bug report] mtd: nand: omap2: fix return value check in omap_nand_probe()
Date: Wed, 3 Aug 2016 15:32:19 +0300	[thread overview]
Message-ID: <20160803123218.GA19033@mwanda> (raw)

Hello Wei Yongjun,

The patch de3bfc4a1616: "mtd: nand: omap2: fix return value check in
omap_nand_probe()" from Jul 14, 2016, leads to the following static
checker warning:

	drivers/mtd/nand/omap2.c:2173 omap_nand_probe()
	error: 'info->dma' dereferencing possible ERR_PTR()

drivers/mtd/nand/omap2.c
  1921          case NAND_OMAP_PREFETCH_DMA:
  1922                  dma_cap_zero(mask);
  1923                  dma_cap_set(DMA_SLAVE, mask);
  1924                  info->dma = dma_request_chan(pdev->dev.parent, "rxtx");
  1925  
  1926                  if (IS_ERR(info->dma)) {
                                   ^^^^^^^^^
  1927                          dev_err(&pdev->dev, "DMA engine request failed\n");
  1928                          err = PTR_ERR(info->dma);
  1929                          goto return_error;
  1930                  } else {
  1931                          struct dma_slave_config cfg;
  1932  
  1933                          memset(&cfg, 0, sizeof(cfg));
  1934                          cfg.src_addr = info->phys_base;
  1935                          cfg.dst_addr = info->phys_base;
  1936                          cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
  1937                          cfg.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
  1938                          cfg.src_maxburst = 16;
  1939                          cfg.dst_maxburst = 16;
  1940                          err = dmaengine_slave_config(info->dma, &cfg);
  1941                          if (err) {
  1942                                  dev_err(&pdev->dev, "DMA engine slave config failed: %d\n",
  1943                                          err);
  1944                                  goto return_error;
  1945                          }
  1946                          nand_chip->read_buf   = omap_read_buf_dma_pref;
  1947                          nand_chip->write_buf  = omap_write_buf_dma_pref;
  1948                  }
  1949                  break;
  1950  

[ snip ]

  2170  
  2171  return_error:
  2172          if (info->dma)
  2173                  dma_release_channel(info->dma);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We can't pass error pointers to dma_release_channel().  I can't compile
this code though, so I'm not going to patch it.

  2174          if (nand_chip->ecc.priv) {
  2175                  nand_bch_free(nand_chip->ecc.priv);
  2176                  nand_chip->ecc.priv = NULL;
  2177          }
  2178          return err;
  2179  }

regards,
dan carpenter

             reply	other threads:[~2016-08-03 12:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-03 12:32 Dan Carpenter [this message]
2016-08-04  7:05 ` [bug report] mtd: nand: omap2: fix return value check in omap_nand_probe() Roger Quadros
2016-08-10 13:48   ` Boris Brezillon
2016-08-15  7:24     ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160803123218.GA19033@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=yongjun_wei@trendmicro.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.