Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3676405pxv; Mon, 19 Jul 2021 06:14:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXLZUbsF694pDBcx7scIKXwtk3lbZurkTag62zQ914wgWH2MYe89qoRW3c7LG7OUieFIi2 X-Received: by 2002:a05:6602:25da:: with SMTP id d26mr18652903iop.106.1626700490761; Mon, 19 Jul 2021 06:14:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626700490; cv=none; d=google.com; s=arc-20160816; b=SLU177CG3ryLYfCyRY/RB3eRhvU17NRTsGGspmD4krAmJikMUPXZvOOTp/cAy9E1aZ JrN9OJZZ6D30Wn0lf7l/oZ8lnlMzaAAbHr9Vj98nyV3PoCbaBpGtQ3i5RGAWwdQ7V+qp 51+DxJyx1ENhu5PExx8WCdQMZ49cxweHD25Pt/1U4f2bEOzP66YbVMdiyLsIksCZQSck ZEBTciQWBhigjGRyk5jPWM2sG6Bav8s+x21k0kGWYMU0dTSQxzAq41hSJ5XsS1UtvsTz 7d7/uUg+7hnNvin3eqOtUpRqmL2dK1QzgbucqjjB3HaEuXE+/WKLqSaNmYJM8voUvd/E wi0A== 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=HM1yQ9OZiA5BvPd15lf0pR2zhQOnuRWUNkrRFdXMxsM=; b=C3+Cw2qRRDXX/9TzG+UmXoGBlQZkYdG7ulm4cF4VCm/923t0waLoAUDzIALuNSk0hO spvrcQ+kctJgMzDi43G4MNByYbIFrY4aS4F9v/aKjw8Le0oy164UJJCGUSj+U2NQHX5P wWp2L0JLKTDWP3iqR1F1akhpRAMQSxtRnAETu5UmZ3Fal1qmDdCFGMA3pN9KFrdMMQi0 Hh8DVNPST4TCmqxRoIVMw4W1urZt+8Ycul/FnfYEZ5NBFX48EvD5yhI2R4XzuJ0GIZkZ 6Nwo+Letfdwa+cYdAVLR3TYq36+iF9Cnyaz+FRs4l4kSCL0avLWLolCmOD+wXlcxOSDL dv2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fXJCTJJx; 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 a5si20256336ioq.24.2021.07.19.06.14.37; Mon, 19 Jul 2021 06:14:50 -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=fXJCTJJx; 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 S237129AbhGSMdY (ORCPT + 99 others); Mon, 19 Jul 2021 08:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236855AbhGSMdX (ORCPT ); Mon, 19 Jul 2021 08:33:23 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52A86C061574; Mon, 19 Jul 2021 05:34:08 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id q10so16414488pfj.12; Mon, 19 Jul 2021 06:14:02 -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=HM1yQ9OZiA5BvPd15lf0pR2zhQOnuRWUNkrRFdXMxsM=; b=fXJCTJJxQfPcxBpLQm+LniFYdC38w9KkzO9FucZHmRQstximGwq5wuEg3IBZGdcJMF cVAlsT7qT4GQHGu3yhSeqnWGms5izzcRPn/vqyuv7Mem6rPkemTr70KPe2lFAnIOpyyy +pyWHILG4SxC84mYYMDupxutl/IJH35Jbftcqv+3ZGF7qq/z/yu7adTLFkY7Ns8m+Kcd 8iBmZC3i84ritXh28wwitGfMX+8CTUJTJd1aarCUDuzn+amxWH8eVIw51zqIvhIm0mB7 HQ0YGzgIFwqwhwJDAPYuI4sE7f34E5gHjHBaxApGbj1fAjq/WWmTgimYeUubS3K3CTdr LerQ== 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=HM1yQ9OZiA5BvPd15lf0pR2zhQOnuRWUNkrRFdXMxsM=; b=Q8GMwt463PBATBEGR7y3Kaewz6kgCyjtqTQvxztCkgQ++d5zAcdduWPfSnCtlZKBWE kN/ITjFY2/0ZpxtM93+mQjJ/83jKYWC7mQDrCH8gITpasK2wMli2UFAP4qBqE3wc7M+S NIdw3ZkYMREWUjwW7nxlQBXox19ANzxSY7U2oK9J2lZdO2YtJ5Z7bm2f2v7UmBlN0MuF LTOpmRiPwm4xnesFJMuTSN59yu7ezDFSncAgq2Ye2e/xNYuDTiQzj0qvn3XxcE9G+QE3 Y64s8AHcY1QIaBV3CpwSgQh2mIwe742KNrSzxn8DqlWuyhatYTv6jppU7Vt0FlhiTs3b JIuQ== X-Gm-Message-State: AOAM532/SQQSCMxprGFG0w0JBPjagJbk/e9pT0NrEC6kB7VtfPp1jWNr TkNWdwafMs4+46yVn2yXSpkIot1L/dto5gz1zaQwRKTF89S5mA== X-Received: by 2002:a63:ae48:: with SMTP id e8mr4325241pgp.0.1626700441918; Mon, 19 Jul 2021 06:14:01 -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 15:13:49 +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 , 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 lun 19 lug 2021 alle ore 13:48 Andy Shevchenko ha scritto: > > On Mon, Jul 19, 2021 at 11:02:07AM +0200, Andrea Merello wrote: > > 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 > > kmemdup_nul() then. That's one seems suitable. Thank you. > > -- > With Best Regards, > Andy Shevchenko > >