Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755583Ab3EICQ7 (ORCPT ); Wed, 8 May 2013 22:16:59 -0400 Received: from mail-wg0-f50.google.com ([74.125.82.50]:46235 "EHLO mail-wg0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774Ab3EICQ6 (ORCPT ); Wed, 8 May 2013 22:16:58 -0400 MIME-Version: 1.0 Date: Thu, 9 May 2013 10:16:56 +0800 Message-ID: Subject: [PATCH] uio: fix error return code in uio_dev_add_attributes() From: Wei Yongjun To: hjk@hansjkoch.de, gregkh@linuxfoundation.org Cc: yongjun_wei@trendmicro.com.cn, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1208 Lines: 36 From: Wei Yongjun Fix to return -ENOMEM in the kobject_create_and_add() and kzalloc() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun --- drivers/uio/uio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c index b645c47..c6dfc31 100644 --- a/drivers/uio/uio.c +++ b/drivers/uio/uio.c @@ -276,6 +276,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) mem = &idev->info->mem[mi]; if (mem->size == 0) break; + ret = -ENOMEM; if (!map_found) { map_found = 1; idev->map_dir = kobject_create_and_add("maps", @@ -301,6 +302,7 @@ static int uio_dev_add_attributes(struct uio_device *idev) port = &idev->info->port[pi]; if (port->size == 0) break; + ret = -ENOMEM; if (!portio_found) { portio_found = 1; idev->portio_dir = kobject_create_and_add("portio", -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/