Re: [PATCH] misc: eeprom: at25: add Cypress FRAM functionality
From: kbuild test robot
Date: Wed Oct 07 2015 - 07:39:41 EST
Hi Jiri,
[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please ignore]
config: i386-randconfig-s1-201540 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
All warnings (new ones prefixed by >>):
drivers/misc/eeprom/at25.c: In function 'at25_fw_to_chip':
drivers/misc/eeprom/at25.c:401:43: warning: passing argument 3 of 'device_property_read_string' from incompatible pointer type [-Wincompatible-pointer-types]
device_property_read_string(dev, "name", &name);
^
In file included from drivers/misc/eeprom/at25.c:22:0:
include/linux/property.h:41:5: note: expected 'const char **' but argument is of type 'char **'
int device_property_read_string(struct device *dev, const char *propname,
^
drivers/misc/eeprom/at25.c: In function 'at25_probe':
>> drivers/misc/eeprom/at25.c:518:16: warning: 'addrlen' may be used uninitialized in this function [-Wmaybe-uninitialized]
at25->addrlen = addrlen;
^
vim +/addrlen +518 drivers/misc/eeprom/at25.c
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 395 int is_fram)
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 396 {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 397 u32 val;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 398 char *name;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 399
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 400 memset(chip, 0, sizeof(*chip));
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 @401 device_property_read_string(dev, "name", &name);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 402 strncpy(chip->name, name, sizeof(chip->name));
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 403
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 404 if (is_fram) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 405 if (device_property_present(dev, "read-only"))
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 406 chip->flags |= EE_READONLY;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 407 return 0;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 408 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 409
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 410 if (device_property_read_u32(dev, "size", &val) == 0 ||
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 411 device_property_read_u32(dev, "at25,byte-len", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 412 chip->byte_len = val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 413 } else {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 414 dev_err(dev, "Error: missing \"size\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 415 return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 416 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 417
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 418 if (device_property_read_u32(dev, "pagesize", &val) == 0 ||
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 419 device_property_read_u32(dev, "at25,page-size", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 420 chip->page_size = (u16)val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 421 } else {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 422 dev_err(dev, "Error: missing \"pagesize\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 423 return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 424 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 425
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 426 if (device_property_read_u32(dev, "at25,addr-mode", &val) == 0) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 427 chip->flags = (u16)val;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 428 } else {
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 429 if (device_property_read_u32(dev, "address-width", &val)) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 430 dev_err(dev,
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 431 "Error: missing \"address-width\" property\n");
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 432 return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 433 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 434 switch (val) {
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 435 case 8:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 436 chip->flags |= EE_ADDR1;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 437 break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 438 case 16:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 439 chip->flags |= EE_ADDR2;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 440 break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 441 case 24:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 442 chip->flags |= EE_ADDR3;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 443 break;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 444 default:
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 445 dev_err(dev,
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 446 "Error: bad \"address-width\" property: %u\n",
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 447 val);
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 448 return -ENODEV;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 449 }
f60e70749 drivers/misc/eeprom/at25.c Mika Westerberg 2014-10-21 450 if (device_property_present(dev, "read-only"))
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 451 chip->flags |= EE_READONLY;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 452 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 453 return 0;
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 454 }
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 455
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 456 static const struct of_device_id at25_of_match[] = {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 457 { .compatible = "atmel,at25", .data = (const void *)IS_EEPROM },
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 458 { .compatible = "cypress,fm25", .data = (const void *)IS_FRAM },
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 459 { }
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 460 };
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 461 MODULE_DEVICE_TABLE(of, at25_of_match);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 462
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 463 static int at25_probe(struct spi_device *spi)
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 464 {
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 465 struct at25_data *at25 = NULL;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 466 struct spi_eeprom chip;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 467 int err;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 468 int sr;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 469 int addrlen;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 470 char id[FM25_ID_LEN];
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 471 const struct of_device_id *match;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 472 int is_fram = 0;
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 473
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 474 match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 475 if (match)
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 476 is_fram = (int)(uintptr_t)match->data;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 477
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 478 /* Chip description */
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 479 if (!spi->dev.platform_data) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 480 err = at25_fw_to_chip(&spi->dev, &chip, is_fram);
d6ae0d578 drivers/misc/eeprom/at25.c David Daney 2012-08-22 481 if (err)
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 482 return err;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 483 } else
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 484 chip = *(struct spi_eeprom *)spi->dev.platform_data;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 485
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 486 /* For now we only support 8/16/24 bit addressing */
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 487 if (!is_fram) {
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 488 if (chip.flags & EE_ADDR1)
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 489 addrlen = 1;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 490 else if (chip.flags & EE_ADDR2)
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 491 addrlen = 2;
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 492 else if (chip.flags & EE_ADDR3)
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 493 addrlen = 3;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 494 else {
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 495 dev_dbg(&spi->dev, "unsupported address type\n");
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 496 return -EINVAL;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 497 }
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 498 }
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 499
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 500 /* Ping the chip ... the status register is pretty portable,
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 501 * unlike probing manufacturer IDs. We do expect that system
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 502 * firmware didn't write it in the past few milliseconds!
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 503 */
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 504 sr = spi_w8r8(spi, AT25_RDSR);
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 505 if (sr < 0 || sr & AT25_SR_nRDY) {
c6ca97d26 drivers/spi/at25.c Atsushi Nemoto 2007-03-16 506 dev_dbg(&spi->dev, "rdsr --> %d (%02x)\n", sr, sr);
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 507 return -ENXIO;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 508 }
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 509
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 510 at25 = devm_kzalloc(&spi->dev, sizeof(struct at25_data), GFP_KERNEL);
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 511 if (!at25)
01fe7b43e drivers/misc/eeprom/at25.c Nikolay Balandin 2013-05-28 512 return -ENOMEM;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 513
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 514 mutex_init(&at25->lock);
002176db8 drivers/misc/eeprom/at25.c Alexandre Pereira da Silva 2012-06-14 515 at25->chip = chip;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 516 at25->spi = spi_dev_get(spi);
41ddcf67b drivers/misc/eeprom/at25.c Jingoo Han 2013-04-05 517 spi_set_drvdata(spi, at25);
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 @518 at25->addrlen = addrlen;
b587b13a4 drivers/spi/at25.c David Brownell 2007-02-12 519
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 520 if (is_fram) {
411f4400b drivers/misc/eeprom/at25.c Jiri Prchal 2015-10-07 521 /* Get ID of chip */
:::::: The code at line 518 was first introduced by commit
:::::: b587b13a4f670ebae79ae6259cf44328455e4e69 [PATCH] SPI eeprom driver
:::::: TO: David Brownell <david-b@xxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxxxxxxxx>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Attachment:
.config.gz
Description: Binary data