From patchwork Fri Sep 21 13:40:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 147278 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp838917ljw; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbfsaZ6EcAMt3Y1PGjtbaTN37dr72M9NMXkbFYpvKcYyrLRdPVe7F4RRtykhAibvKoW357o X-Received: by 2002:a65:4384:: with SMTP id m4-v6mr41505597pgp.265.1537537350826; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537537350; cv=none; d=google.com; s=arc-20160816; b=od9ZUm40XsBGZ/l5MD/QYk29k9tA48b56PH9kyIRS9ItSdS4yQYtU4XyBnw8mkkfou E4Wkykj8VKqRBT0AlqLpH/wgS2pXUA/+F3ifjHwuCINf1Vt+qtsWsV3ZXnPWH0T3E6Xu vMP7o/TrdxvrOTWJfK2WcQIR8tDlvrc9B/2ipnk1Kpav+ODoBqATjRpXhhWq6/viswOb mF1RfKR8TioHG2bpJ698dN9wmge8uzCjDa896pQGXz7Wte6Xs7iz6CmtOQnuYhcY3tn4 D9zRSw38+C+8POP2ZyRBnLVOYfZN4LL+LuQ7B0ZtBw68daXWfcy2QpYdLy0qrQbpXo4p MAbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=YV+S/NaIcoo8iy/1VgIASuYqp6IFliHOp6tvP4DPHND0XZqBgedGjMqF8cW5TM8IUD opz5ivTZv9278rZqPAYnw75cvaReFSTD05mX4Co3bqJCfS02t8LALpq0uXzKk4W66GV2 V4cPlhA1DhmFu73Z9ZzKPFFeHYKp3pyvRNQsAEC1qGWm8mDcDWKkBwRn/jLoxO6kscx5 ysJrHEWJluluE071VW5H8Y9XB/aaWinMItAhCv16y0Kyd7AiWO+Swkx+iQflnQXzo1P4 LZmv7WOpWNcR4HZeTAcithCFM41Ur/3lXOsmachmDuTwUr2+LRO5anNCc+4BXSuEsYtV jsQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WlL6WKz2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6-v6si24641803pls.150.2018.09.21.06.42.30; Fri, 21 Sep 2018 06:42:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WlL6WKz2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390475AbeIUTbY (ORCPT + 32 others); Fri, 21 Sep 2018 15:31:24 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:38640 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389870AbeIUT3h (ORCPT ); Fri, 21 Sep 2018 15:29:37 -0400 Received: by mail-it1-f194.google.com with SMTP id p129-v6so1931820ite.3 for ; Fri, 21 Sep 2018 06:40:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=WlL6WKz2mOgkorbaT1BwHyRjM1RjxiL+avqMGmExl+ycqFj3m9IaoHF4nPDOHc8Bf1 0Xb7/iSzprTmjhP5IUnHmjse+ptxjk8SiK52VErC5PBcWC8zJDtRgvyXkqHYtz/L6Nb5 PfG2UbRAEWpeL4HSmXQKyT4F/ZuJnxhb0iW4M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B8MUx6E9DqKVpcFO4+o4SdtmZtHPgBuDxKs+F+ULmhc=; b=ufn6DiMeDeUfof1AxOLS3VFLO2H3EnHIo5kss5rdjnJTBEavntSIgGtBk1HT0C7EoA 7c3ht8ViQDyFTgOo7Tu/Tuz/DcZLWn18IV3oOtiYkvNQxhFOI+mS5gVV8vtpfHy5p9E8 B3XYJpmjDhUL68jXPB6F96BpiVZKEctLt3cXT+2vN5gGFr6fc9lOnMRMI6jzJVzr2yXt gnGqXZnrLSatoi+oTLoDKhFRvUWSzJFELI1YS+xGSIg3N4JLEwGsymqumZR/MNgc5zDC BWHNn61bUZHhLMdPYNenVbB1qhsnEQA7uVJT71qhUUpAP8x32XVQt4Gzolj9U7puyXuk L+eA== X-Gm-Message-State: APzg51DIaqJ/zYJPUAMuqrGMwfNhlba5Ocxha7Yh9Kr3urgsGvhNjt58 iQgKGAajS6lMhcel4lOYbxQdzw== X-Received: by 2002:a24:3d52:: with SMTP id n79-v6mr5756180itn.68.1537537242725; Fri, 21 Sep 2018 06:40:42 -0700 (PDT) Received: from localhost.localdomain ([209.82.80.116]) by smtp.gmail.com with ESMTPSA id c12-v6sm9896298ioq.81.2018.09.21.06.40.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:40:42 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Bartosz Golaszewski , Srinivas Kandagatla Subject: [PATCH 07/26] nvmem: check the return value of nvmem_add_cells() Date: Fri, 21 Sep 2018 06:40:07 -0700 Message-Id: <20180921134026.4596-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> References: <20180921134026.4596-1-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski This function can fail so check its return value in nvmem_register() and act accordingly. Signed-off-by: Bartosz Golaszewski Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.19.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 1ced9caa811b..0ef84441ebe5 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -512,11 +512,17 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) goto err_device_del; } - if (config->cells) - nvmem_add_cells(nvmem, config->cells, config->ncells); + if (config->cells) { + rval = nvmem_add_cells(nvmem, config->cells, config->ncells); + if (rval) + goto err_teardown_compat; + } return nvmem; +err_teardown_compat: + if (config->compat) + device_remove_bin_file(nvmem->base_dev, &nvmem->eeprom); err_device_del: device_del(&nvmem->dev); err_put_device: