From mboxrd@z Thu Jan 1 00:00:00 1970 From: Claude Code Review Bot To: dri-devel-reviews@example.com Subject: Claude review: firmware: qcom: Add a generic PAS service Date: Mon, 25 May 2026 18:55:29 +1000 Message-ID: In-Reply-To: <20260522115936.201208-3-sumit.garg@kernel.org> References: <20260522115936.201208-1-sumit.garg@kernel.org> <20260522115936.201208-3-sumit.garg@kernel.org> X-Mailer: Claude Code Patch Reviewer Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 Patch Review This is the core abstraction layer. **Race condition in `qcom_pas_ops_register()`:** ```c void qcom_pas_ops_register(struct qcom_pas_ops *ops) { if (!qcom_pas_is_available()) smp_store_release(&ops_ptr, ops); else pr_err("qcom_pas: ops already registered by %s\n", ops_ptr->drv_name); } ``` This has a TOCTOU race -- two concurrent callers could both see `!qcom_pas_is_available()` as true and both proceed to store. The second store would silently overwrite the first. Consider using `cmpxchg()` instead: ```c if (cmpxchg(&ops_ptr, NULL, ops) != NULL) pr_err(...); ``` **No NULL check on ops callbacks**: The generic functions like `qcom_pas_init_image()` check `!ops_ptr` but never verify that individual callbacks (e.g., `ops_ptr->init_image`) are non-NULL. If a backend registers with a partially populated ops struct, it would crash. This could be a deliberate design choice (all callbacks are mandatory), but it's worth documenting. **`qcom_pas_metadata_release` has defensive checks the backend doesn't need:** ```c void qcom_pas_metadata_release(struct qcom_pas_context *ctx) { if (!ops_ptr || !ctx || !ctx->ptr) return; ops_ptr->metadata_release(ops_ptr->dev, ctx); } ``` Good -- the outer layer guards mean backends can assume `ctx` and `ctx->ptr` are valid. **Module with no init function**: `qcom_pas.c` has `MODULE_LICENSE`/`MODULE_DESCRIPTION` but no `module_init`/`module_exit`. It's purely a library module. This works but means the module can be unloaded while backends hold references to the exported symbols. Consider whether this should be a non-module (bool Kconfig) or whether backends should hold a module reference. --- Generated by Claude Code Patch Reviewer