Re: [tty:tty-next 42/62] drivers/tty/serial/sccnxp.c:894 sccnxp_probe() error: we previously assumed 'pdata' could be null (see line 887)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Hi Alexander,
> 
> FYI, there are new smatch warnings show up in
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next
> head:   e27a7d7977b07d701ba247e2ddb95466d95c898f
> commit: ec063899b7b308019afa9f5eb32f0a58a6c6ee53 [42/62] serial: sccnxp: Implement polling mode
> 
> New smatch warnings:
> drivers/tty/serial/sccnxp.c:894 sccnxp_probe() error: we previously assumed 'pdata' could be null (see line 887)
> 
> git remote add tty git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
> git remote update tty
> git checkout ec063899b7b308019afa9f5eb32f0a58a6c6ee53
> vim +/pdata +894 drivers/tty/serial/sccnxp.c
> 
> 1d65c0b1 Alexander Shiyan 2012-08-25  881  	default:
> 1d65c0b1 Alexander Shiyan 2012-08-25  882  		dev_err(&pdev->dev, "Unsupported chip type %i\n", chiptype);
> 1d65c0b1 Alexander Shiyan 2012-08-25  883  		ret = -ENOTSUPP;
> 1d65c0b1 Alexander Shiyan 2012-08-25  884  		goto err_out;
> 1d65c0b1 Alexander Shiyan 2012-08-25  885  	}
> 1d65c0b1 Alexander Shiyan 2012-08-25  886  
> 1d65c0b1 Alexander Shiyan 2012-08-25 @887  	if (!pdata) {
> 1d65c0b1 Alexander Shiyan 2012-08-25  888  		dev_warn(&pdev->dev,
> 1d65c0b1 Alexander Shiyan 2012-08-25  889  			 "No platform data supplied, using defaults\n");
> 1d65c0b1 Alexander Shiyan 2012-08-25  890  		s->pdata.frequency = s->freq_std;
> 1d65c0b1 Alexander Shiyan 2012-08-25  891  	} else
> 1d65c0b1 Alexander Shiyan 2012-08-25  892  		memcpy(&s->pdata, pdata, sizeof(struct sccnxp_pdata));
> 1d65c0b1 Alexander Shiyan 2012-08-25  893  
> ec063899 Alexander Shiyan 2012-12-03 @894  	if (pdata->poll_time_us) {
> ec063899 Alexander Shiyan 2012-12-03  895  		dev_info(&pdev->dev, "Using poll mode, resolution %u usecs\n",
> ec063899 Alexander Shiyan 2012-12-03  896  			 pdata->poll_time_us);
> ec063899 Alexander Shiyan 2012-12-03  897  		s->poll = 1;
 
I agree. In this case (line 894), there should be:
if (s->pdata.poll_time_us) {
		dev_info(&pdev->dev, "Using poll mode, resolution %u usecs\n",
			 s->pdata.poll_time_us);
...

Today, post the fix. Thank you.

---
��.n��������+%������w��{.n�����{��ǫ����{ay�ʇڙ���f���h������_�(�階�ݢj"��������G����?���&��



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux