Skip to contentSkip to conversation

serial: sprd: Add DMA mode support

bug report Dan Carpenter 2 participants 2 messages Mar 12, 2020 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

Hello Lanqing Liu,

The patch f4487db58eb7: "serial: sprd: Add DMA mode support" from Mar 4, 2019, leads to the following static checker warning:

	drivers/tty/serial/sprd_serial.c:1141 sprd_remove()
	error: we previously assumed 'sup' could be null (see line 1132)

drivers/tty/serial/sprd_serial.c
1128 static int sprd_remove(struct platform_device *dev) 1129 {
1130 struct sprd_uart_port *sup = platform_get_drvdata(dev);
1131

  1132          if (sup) {
                    ^^^

Check

  1133                  uart_remove_one_port(&sprd_uart_driver, &sup->port);
  1134                  sprd_port[sup->port.line] = NULL;
  1135                  sprd_ports_num--;
  1136          }
  1137  
  1138          if (!sprd_ports_num)
  1139                  uart_unregister_driver(&sprd_uart_driver);
  1140  
  1141          sprd_rx_free_buf(sup);
                                 ^^^

Unchecked dereference inside function

1142
1143 return 0;
1144 }

regards,
dan carpenter

#1 lore raw

Hi dan carpenter

Thank you for your review code.
I will commit a new patch to fix this warning.

BR
liulanqing

-----邮件原件-----
发件人: Dan Carpenter [mailto:[email protected]] 发送时间: 2020年3月12日 16:01
收件人: 刘岚清 (Lanqing Liu)
抄送: [email protected]
主题: [bug report] serial: sprd: Add DMA mode support

Hello Lanqing Liu,

The patch f4487db58eb7: "serial: sprd: Add DMA mode support" from Mar 4, 2019, leads to the following static checker warning:

drivers/tty/serial/sprd_serial.c:1141 sprd_remove()
error: we previously assumed 'sup' could be null (see line 1132)

drivers/tty/serial/sprd_serial.c
1128 static int sprd_remove(struct platform_device *dev) 1129 {
1130 struct sprd_uart_port *sup = platform_get_drvdata(dev);
1131

  1132          if (sup) {
                    ^^^

Check

  1133                  uart_remove_one_port(&sprd_uart_driver, &sup->port);
  1134                  sprd_port[sup->port.line] = NULL;
  1135                  sprd_ports_num--;
  1136          }
  1137
  1138          if (!sprd_ports_num)
  1139                  uart_unregister_driver(&sprd_uart_driver);
  1140
  1141          sprd_rx_free_buf(sup);
                                 ^^^

Unchecked dereference inside function

1142
1143 return 0;
1144 }

regards,
dan carpenter
________________________________
This email (including its attachments) is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. Unauthorized use, dissemination, distribution or copying of this email or the information herein or taking any action in reliance on the contents of this email or the information herein, by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is strictly prohibited. If you are not the intended recipient, please do not read, copy, use or disclose any part of this e-mail to others. Please notify the sender immediately and permanently delete this e-mail and any attachments if you received it in error. Internet communications cannot be guaranteed to be timely, secure, error-free or virus-free. The sender does not accept liability for any errors or omissions.
本邮件及其附件具有保密性质,受法律保护不得泄露,仅发送给本邮件所指特定收件人。严禁非经授权使用、宣传、发布或复制本邮件或其内容。若非该特定收件人,请勿阅读、复制、 使用或披露本邮件的任何内容。若误收本邮件,请从系统中永久性删除本邮件及所有附件,并以回复邮件的方式即刻告知发件人。无法保证互联网通信及时、安全、无误或防毒。发件人对任何错漏均不承担责任。