[PATCH 1/2] i2c-tiny-usb: Delete an error message for a failed memory allocation in i2c_tiny_usb_probe()

From: SF Markus Elfring
Date: Thu Feb 01 2018 - 11:57:09 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Feb 2018 17:36:50 +0100

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
drivers/i2c/busses/i2c-tiny-usb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tiny-usb.c b/drivers/i2c/busses/i2c-tiny-usb.c
index a2e3dd715380..e210e36df123 100644
--- a/drivers/i2c/busses/i2c-tiny-usb.c
+++ b/drivers/i2c/busses/i2c-tiny-usb.c
@@ -230,10 +230,8 @@ static int i2c_tiny_usb_probe(struct usb_interface *interface,

/* allocate memory for our device state and initialize it */
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
- if (dev == NULL) {
- dev_err(&interface->dev, "Out of memory\n");
+ if (!dev)
goto error;
- }

dev->usb_dev = usb_get_dev(interface_to_usbdev(interface));
dev->interface = interface;
--
2.16.1