From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E56C8C001B0 for ; Thu, 13 Jul 2023 12:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233819AbjGMMof convert rfc822-to-8bit (ORCPT ); Thu, 13 Jul 2023 08:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbjGMMod (ORCPT ); Thu, 13 Jul 2023 08:44:33 -0400 Received: from mail-yw1-f181.google.com (mail-yw1-f181.google.com [209.85.128.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744FB212E for ; Thu, 13 Jul 2023 05:44:32 -0700 (PDT) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-57a6df91b1eso5731867b3.1 for ; Thu, 13 Jul 2023 05:44:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689252271; x=1691844271; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hz+Lx2AHPiC1tEoYOibbkH4KESx0nTtUs5AmfKyrn3g=; b=FB1vnXHEJMHPhhqF+gTKVJSUCvyqDw1nU1SUFEy2fcjVDYVvbM7EX0Re7VeCPXTFYG fyB1c53ykTAGCSVoN+2QOKrnRr4LaUFt2grOkS6iTapURZcjVpwhWgqbLl+X2agob9qW ojYZQ+VXRRsavdjT18jj39yheEG9RjluEQugk1ZVj0Gop5/Dh2+2PK8+AbTE2aq4EhVv 3AJSNnik4ztcN09zhBzbL6Or26naBqVa1J/TmRTfotCp8lnzeUJKCctpXNITDienKuie cPjMY9zrxahBBGztMq5VhZlf8KjJCQPjVUy5xzNmZS5LN+V5C39oJfMyapqY8+GpvOQd AWlw== X-Gm-Message-State: ABy/qLZjrusJmgXZDZv6T07xxcFurHrjQrR4ul0Y9LROvE0iWoyCfF6H B+V3RTtBOx8hl1Ib5sa23fUgR+NF3wqoKGnm X-Google-Smtp-Source: APBJJlG4M73gsXKXFCL2KjEc4Os5Pw+D95twdw84HoAQlaSzatc1Blt09hXDD0pCWe0dhxP7SMa1fQ== X-Received: by 2002:a81:8443:0:b0:576:f0d6:3d68 with SMTP id u64-20020a818443000000b00576f0d63d68mr1371822ywf.32.1689252271275; Thu, 13 Jul 2023 05:44:31 -0700 (PDT) Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com. [209.85.128.171]) by smtp.gmail.com with ESMTPSA id o126-20020a0dcc84000000b00577322f8fd3sm1742867ywd.18.2023.07.13.05.44.30 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jul 2023 05:44:30 -0700 (PDT) Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-57712d00cc1so5729787b3.3 for ; Thu, 13 Jul 2023 05:44:30 -0700 (PDT) X-Received: by 2002:a0d:cb41:0:b0:56f:fffc:56ff with SMTP id n62-20020a0dcb41000000b0056ffffc56ffmr1622296ywd.42.1689252270339; Thu, 13 Jul 2023 05:44:30 -0700 (PDT) MIME-Version: 1.0 References: <20230609170941.1150941-1-javierm@redhat.com> <20230609170941.1150941-5-javierm@redhat.com> In-Reply-To: <20230609170941.1150941-5-javierm@redhat.com> From: Geert Uytterhoeven Date: Thu, 13 Jul 2023 14:44:15 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/5] drm/ssd130x: Don't allocate buffers on each plane update To: Javier Martinez Canillas Cc: linux-kernel@vger.kernel.org, Thomas Zimmermann , Maxime Ripard , Daniel Vetter , David Airlie , dri-devel@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Javier, On Fri, Jun 9, 2023 at 7:09 PM Javier Martinez Canillas wrote: > The resolutions for these panels are fixed and defined in the Device Tree, > so there's no point to allocate the buffers on each plane update and that > can just be done once. > > Let's do the allocation and free on the encoder enable and disable helpers > since that's where others initialization and teardown operations are done. > > Signed-off-by: Javier Martinez Canillas > Reviewed-by: Thomas Zimmermann > --- > > (no changes since v1) Thanks for your patch, which is now commit 49d7d581ceaf4cf8 ("drm/ssd130x: Don't allocate buffers on each plane update") in drm-misc/for-linux-next. > --- a/drivers/gpu/drm/solomon/ssd130x.c > +++ b/drivers/gpu/drm/solomon/ssd130x.c > @@ -701,14 +709,22 @@ static void ssd130x_encoder_helper_atomic_enable(struct drm_encoder *encoder, > return; > > ret = ssd130x_init(ssd130x); > - if (ret) { > - ssd130x_power_off(ssd130x); > - return; > - } > + if (ret) > + goto power_off; > + > + ret = ssd130x_buf_alloc(ssd130x); This appears to be too late, causing a NULL pointer dereference: [ 59.302761] [] ssd130x_update_rect.isra.0+0x13c/0x340 [ 59.304231] [] ssd130x_primary_plane_helper_atomic_update+0x26c/0x284 [ 59.305716] [] drm_atomic_helper_commit_planes+0xfc/0x27c Bailing out from ssd130x_update_rect() when data_array is still NULL fixes that. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds