Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3516824pxv; Mon, 19 Jul 2021 02:04:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaM8uRmSGVxNksQvCLyKBc7NOn6DpSX1CFrDUsEHCiZxWsERggY9E/VtunoIP49ssOt/n9 X-Received: by 2002:a92:c8c3:: with SMTP id c3mr16280241ilq.153.1626685440687; Mon, 19 Jul 2021 02:04:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626685440; cv=none; d=google.com; s=arc-20160816; b=vfWEQYBvCPC/8rNjJw2o18ad7PgYa0nBMyqdbEuN89oXELniP+9cCu9OKcw6QRjW6l RCX8xNvfORygrALjp0iHWB/5iUqWbrarn+M6Tmlo3X8vFptpoVS7OY6nyQx/grEX3REj zZuthTckAMhM5q2zFFYhKoh5Y96h+C7B24y2lErUyqBe6/id6F4/6cq1FwYZ8NhXjegn FVsVZrA07OdOlxeuFXZ0YX6MMeGE9yiLVZb3pet7cExxGWzN/D2li7fp+YktIjjKzwrx 6rmHFbx4K02l5alnoBzWHlVjeIfubS7pZ/M+oVxG+I4l0FN2qZVaop7hxSvSAs4MtWfc j6EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version:dkim-signature; bh=7CPkM/PC09FWcMi9Eu2o6KPkbaMxUaV2+b6rFKLJXGg=; b=hgm0QXLNPuzl9TQM9DL/QyeOk4d0hrQCquZqpVsQiiWcvZ74rD2PhIqXsK9zaoBrrf dbmQe4BWly+ErXW3rjntlBltMK5FjOWtmKd/ih35xku2sK4R5bwnS8OuLu5U4HEWqAXl lQ3itHfhI9g2Wujwd2aLjlaTHKVT/yOv3yu6f3Z4Fvm7nTustZWniVeFrg83V1xM4yuq QEL/mdbiI4McusdLWW7aMtP280MR1KFh5WRyLyMkUIgQrNRktRP8SZqY6cuR4+a2Z/8z NxNsqd3BdId4I2iGTLYi/mCuUb3fXEsYwB5hu354CBsrQW65xLhHYG/4jcT5V+2X3aYp rYVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RlMHSiKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si6572014jam.109.2021.07.19.02.03.49; Mon, 19 Jul 2021 02:04:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RlMHSiKG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235547AbhGSIWk (ORCPT + 99 others); Mon, 19 Jul 2021 04:22:40 -0400 Received: from mail-pj1-f46.google.com ([209.85.216.46]:44892 "EHLO mail-pj1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235129AbhGSIWj (ORCPT ); Mon, 19 Jul 2021 04:22:39 -0400 Received: by mail-pj1-f46.google.com with SMTP id p4-20020a17090a9304b029016f3020d867so11985395pjo.3; Mon, 19 Jul 2021 02:03:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:reply-to:from:date:message-id :subject:to:cc; bh=7CPkM/PC09FWcMi9Eu2o6KPkbaMxUaV2+b6rFKLJXGg=; b=RlMHSiKGPgNvAqmJ3fONaKQbOFJTLMSj5hkuBRmAkXFUvk9VgkhtQauD/lHDJ0V293 a9rEDjQE1wcLG3+CtoQQqHHs2hiKUqT4iueRg+GvJcD5/Eiw9fnOCyCOIfuudY3PSNaO hm23uhpE09sOaQF3Cp2eedFlNaXk8711LXNrpoDtQ7F9sApMlBK7Km0CdbuKUfUYt8Rb IzoifFITJZP5QvBrzVaVNXKoFBUHfFBdc3CzKhO6BqAPNLEUoqxxQhFwOoZdhoTmhw0p 0xppCdho7nLRVVwfDjS/NrLkZCTNupJR1zTrjD6Yiq15fPo4XVUsJE76t31QDWCSnpsi hcuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=7CPkM/PC09FWcMi9Eu2o6KPkbaMxUaV2+b6rFKLJXGg=; b=YRxYcjq5L15IOYj1TPve6TQ5u6raAGhjwQxGDNzai8DqQn7YRsmib28EEOoZdCS+89 J5eOhfOSphmOTz6BirFhLHI5Hadl3lAgwTxBZED2gUzsSdxNmwvx0DzGFjBmQ21caCVk HVGWpXeWXmSpAS9+FahyCdhD4Xpf/a32UDBNqtv0Pdajd5anZmqjdVW7LxtxnJvlWxnP pyVvznQxuxGf/GLX/CyPJKnpda9x7HWE1ttff8CVgajehXS+LrfRVsgA9OHUg6rXt4Qd qjjM3ByvmjHrFCF2wvm1e2PEjPapTWqUzXtcrUKnkuF5Q4VEnQpPesYS+zDzNJDwlI42 sBsg== X-Gm-Message-State: AOAM533He/3g1s3CTZBOlX1lVlWs1jWCepCv0h4Vu9WDy1v/Q1pML6pa IGW2DWbEbQK8n+PYO8jP2tyVr1nZYZwKENMZY8g= X-Received: by 2002:a17:902:eb52:b029:129:bc24:ce5e with SMTP id i18-20020a170902eb52b0290129bc24ce5emr18514435pli.67.1626685338969; Mon, 19 Jul 2021 02:02:18 -0700 (PDT) MIME-Version: 1.0 References: <20210715141742.15072-1-andrea.merello@gmail.com> <20210715141742.15072-3-andrea.merello@gmail.com> In-Reply-To: Reply-To: andrea.merello@gmail.com From: Andrea Merello Date: Mon, 19 Jul 2021 11:02:07 +0200 Message-ID: Subject: Re: [PATCH 2/4] iio: imu: add Bosch Sensortec BNO055 core driver To: Andy Shevchenko Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Matt Ranostay , Andy Shevchenko , vlad.dogaru@intel.com, linux-kernel , linux-iio , Andrea Merello Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il giorno gio 15 lug 2021 alle ore 18:50 Andy Shevchenko ha scritto: > > > +/* must be called in configuration mode */ > > +int bno055_calibration_load(struct bno055_priv *priv, const struct firmware *fw) > > +{ > > + int i; > > + unsigned int tmp; > > + u8 cal[BNO055_CALDATA_LEN]; > > + int read, tot_read = 0; > > + int ret = 0; > > + char *buf = kmalloc(fw->size + 1, GFP_KERNEL); > > + > > + if (!buf) > > + return -ENOMEM; > > + > > + memcpy(buf, fw->data, fw->size); > > kmemdup() ? > As a second thought: no, the whole point of reallocating and copying here, is that we want to allocate an extra byte; kmemdup() will allocate and copy only the very same amount of memory