From patchwork Fri Dec 15 14:06:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 122107 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp526996qgn; Fri, 15 Dec 2017 06:15:17 -0800 (PST) X-Google-Smtp-Source: ACJfBovbcKChpSYMS8k9sHTs1jrWR9y+eFJeX3AseynbTP3qM2vkvzsrRk03T1xeTJtRQ8YV/t9u X-Received: by 10.98.46.7 with SMTP id u7mr13582576pfu.37.1513347316928; Fri, 15 Dec 2017 06:15:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513347316; cv=none; d=google.com; s=arc-20160816; b=yITj1NBcMBQHkned+4UpmwtT2ua3gPyEdsmRn1VLiP9uoqymYRPg/bRAH+hYfW0wC3 MhYhG+5Z8bJ1YAavIuBRzxHHtKvT2TXtb73p4XLboM1jgrJeEs3NcEdS+/B2U/dFjDhr DspXWJFtsy214YTRt34OacK5lZnwfEvOc7RQ1xoTvIc/eN6SWMTRt5xEiOGuWFESZLGd JG1M3WG1fv4tlWUIuzpxqsuqNsR9HJvqvuVLkzxWXo5ZcZtoRElYpHkEHrMco2ssFB4O K3PUA03QvnrswsRoJ09eCVgQKozs3GU78/mq2pHiUCHExRC9gnCM4kKhZWmquRK2n4HU Fgug== 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:arc-authentication-results; bh=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=rh4tJaZL6h1AMjuGBjQWXGmTdKF+/smFeeAjBp4tq+/7025WfwPxMkPb988+omn/Ju O9fnBuwvnjJxrMv/QuLnJxeNS4J7kVHa+Q/5il5cjpT6qE7eV0FXjljtHjiKN03JrZb7 wuLwCdSJJrAuyg9SU+/d07Pc3EGipx92zNWg47kNSMAHIHRb0W9iO8GsSu2rNHWYmetG QuOGsAlKPNbzazNirQG6lWbNZWG4nV87imcf0RADhSduA9+mzMBAYwuXsAESxxAP6Eme /mkby72AcULOLo1aI5c/kEpH3/EmmXrbpeHZn/iJOmLEwpqR/f/MTosPXPC3+Rsur33Q uWyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JZkzz6wx; 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 r1si4591862pgp.308.2017.12.15.06.15.16; Fri, 15 Dec 2017 06:15:16 -0800 (PST) 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=JZkzz6wx; 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 S1756411AbdLOOPN (ORCPT + 20 others); Fri, 15 Dec 2017 09:15:13 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34509 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756100AbdLOOJd (ORCPT ); Fri, 15 Dec 2017 09:09:33 -0500 Received: by mail-wm0-f66.google.com with SMTP id y82so30770255wmg.1 for ; Fri, 15 Dec 2017 06:09:32 -0800 (PST) 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=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=JZkzz6wxMj52/8x+96831BUXZqXC2/O5lj8iAtjWeFNsOvXXgAwo38PwoywzrtMpAI gsscC5G29vj5xTOW78tOZK6kHnkwp9oQ80cK8BW74qfzSkhQaa7w8rZ4IpdLaLMLTrhL Qju7qy9iW+tkLIKP1P/ulQ9AopPRdan1vLSlM= 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=MWOL2LsQfCZ84KdcmRUInC8SSCIGlI4mw1tChUUoTt0=; b=iTKxsWvRP1FxZRPI8dILl5A4hvHr8491Ctu6tGdMmT09eK0123vQ7YoNviZqib+LNW EFyKxT+hMt8DZzV542IgD0MH+8ClnpRsmbzROnIKa4+pD4ZxZXITbrbP9S5UpwODEO4Y 5zSdnrhlTyC0J+riZCVHl8lKu5s+VmhuFthjpeJEqpvCKGv4wRUjgLTdTJgHrUfT+nne mEUEMhBfurFixtR6LzPYWmlUr0Cnx7EwHq9u61wP0Pqg8Ow+l6G0W5cHKytHg0Ub5GpR 13HEPpb2obtrEcfpoKuIRqodo7ZcUnxQwE7vN82RLxfCh2ea9Fh8dLupAb1CC/SFFGZq Jisw== X-Gm-Message-State: AKGB3mK51mDhGQnR9xtxElO5aaB6UyCmsSq8XY4cBCzLF1QiPd7IBssQ GO7APDG2rldbBI6j5iTPXtoa8A== X-Received: by 10.28.234.87 with SMTP id i84mr5447748wmh.65.1513346972260; Fri, 15 Dec 2017 06:09:32 -0800 (PST) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id n7sm6295034wra.23.2017.12.15.06.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Dec 2017 06:09:31 -0800 (PST) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, srinivas.kandagatla@linaro.org, Heiner Kallweit Subject: [PATCH 2/6] nvmem: core: let stride and word_size default to 1 Date: Fri, 15 Dec 2017 14:06:05 +0000 Message-Id: <20171215140609.17193-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20171215140609.17193-1-srinivas.kandagatla@linaro.org> References: <20171215140609.17193-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: Heiner Kallweit If the caller doesn't set stride and/or word_size in struct nvmem_config then nvmem_register accepts this but we may face strange effects later due to both values being 0. Therefore use 1 as default for both values. Signed-off-by: Heiner Kallweit Signed-off-by: Srinivas Kandagatla --- drivers/nvmem/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.15.0 diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 93084ab61e0f..4f37c9f3d120 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -464,8 +464,8 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config) nvmem->owner = config->owner; if (!nvmem->owner && config->dev->driver) nvmem->owner = config->dev->driver->owner; - nvmem->stride = config->stride; - nvmem->word_size = config->word_size; + nvmem->stride = config->stride ?: 1; + nvmem->word_size = config->word_size ?: 1; nvmem->size = config->size; nvmem->dev.type = &nvmem_provider_type; nvmem->dev.bus = &nvmem_bus_type;