re: gpio: max732x: add error handling for i2c_new_dummy

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

 



drivers/gpio/gpio-max732x.c
   651          switch (client->addr & 0x70) {
   652          case 0x60:
   653                  chip->client_group_a = client;
   654                  if (nr_port > 8) {
   655                          c = i2c_new_dummy(client->adapter, addr_b);
   656                          if (!c) {
                                    ^^
   657                                  dev_err(&client->dev,
   658                                          "Failed to allocate I2C device\n");
   659                                  ret = -ENODEV;
   660                                  goto out_failed;
   661                          }
   662                          chip->client_group_b = chip->client_dummy = c;
   663                  }
   664                  break;
   665          case 0x50:
   666                  chip->client_group_b = client;
   667                  if (nr_port > 8) {
   668                          c = i2c_new_dummy(client->adapter, addr_a);
   669                          if (!c) {
                                    ^^
We added some new error handling.

   670                                  dev_err(&client->dev,
   671                                          "Failed to allocate I2C device\n");
   672                                  ret = -ENODEV;
   673                                  goto out_failed;
   674                          }
   675                          chip->client_group_a = chip->client_dummy = c;
   676                  }
   677                  break;
   678          default:
   679                  dev_err(&client->dev, "invalid I2C address specified %02x\n",
   680                                  client->addr);
   681                  ret = -EINVAL;
   682                  goto out_failed;
   683          }
   684  
   685          if (nr_port > 8 && !chip->client_dummy) {
                                    ^^^^^^^^^^^^^^^^^^
But we actually added a check for that already in 2014.

   686                  dev_err(&client->dev,
   687                          "Failed to allocate second group I2C device\n");
   688                  ret = -ENODEV;
   689                  goto out_failed;
                        ^^^^^^^^^^^^^^^
This is a no-op.  We could just do a direct return instead if we wanted.

   690          }

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux