linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: nfc: st21nfca: Add support for acpi probing for i2c device.
@ 2016-03-17 17:35 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-03-17 17:35 UTC (permalink / raw)
  To: christophe.ricard; +Cc: linux-wireless

Hello Christophe Ricard,

The patch dfa8070d7f64: "nfc: st21nfca: Add support for acpi probing
for i2c device." from Dec 23, 2015, leads to the following static
checker warning:

	drivers/nfc/st21nfca/i2c.c:530 st21nfca_hci_i2c_acpi_request_resources()
	error: 'gpiod_ena' dereferencing possible ERR_PTR()

drivers/nfc/st21nfca/i2c.c
   507  static int st21nfca_hci_i2c_acpi_request_resources(struct i2c_client *client)
   508  {
   509          struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client);
   510          const struct acpi_device_id *id;
   511          struct gpio_desc *gpiod_ena;
   512          struct device *dev;
   513  
   514          if (!client)
   515                  return -EINVAL;
   516  
   517          dev = &client->dev;
   518  
   519          /* Match the struct device against a given list of ACPI IDs */
   520          id = acpi_match_device(dev->driver->acpi_match_table, dev);
   521          if (!id)
   522                  return -ENODEV;
   523  
   524          /* Get EN GPIO from ACPI */
   525          gpiod_ena = devm_gpiod_get_index(dev, ST21NFCA_GPIO_NAME_EN, 1,
   526                                           GPIOD_OUT_LOW);
   527          if (!IS_ERR(gpiod_ena))
   528                  phy->gpio_ena = desc_to_gpio(gpiod_ena);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is correct.

   529  
   530          phy->gpio_ena = desc_to_gpio(gpiod_ena);
                                ^^^^^^^^^^^^^^^^^^^^^^^
This will oops.  Maybe just delete this line.

   531  
   532          phy->irq_polarity = irq_get_trigger_type(client->irq);
   533  
   534          phy->se_status.is_ese_present =
   535                                  device_property_present(dev, "ese-present");
   536          phy->se_status.is_uicc_present =
   537                                  device_property_present(dev, "uicc-present");
   538  
   539          return 0;
   540  }


regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-03-17 17:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-17 17:35 nfc: st21nfca: Add support for acpi probing for i2c device Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).